home *** CD-ROM | disk | FTP | other *** search
-
- /***************************************************************************
-
- XATARI.C
-
- - Atari 800 service routines
-
- 02/11/88 created
- 03/03/88 Laser C
-
- 07/26/88 19:00
-
- ***************************************************************************/
-
- #include "xatari.h"
-
- /* NMI, IRQ interrupts kept in separate bytes for easier checking of each */
-
- /* bit masks for NMI interrupt byte (matches $D40E) */
- #define INT_DLI 0x80
- #define INT_VBI 0x40
- #define INT_RESET 0x20
-
- #define BIT_DLI 7
- #define BIT_VBI 6
- #define BIT_RESET 5
-
- /* bit masks for IRQ interrupt byte (matches $D20E) */
- #define INT_BREAK 0x80
- #define INT_KEY 0x40
- #define INT_4 0x04
- #define INT_2 0x02
- #define INT_1 0x01
-
- #define BIT_BREAK 7
- #define BIT_KEY 6
- #define BIT_4 2
- #define BIT_2 1
- #define BIT_1 0
-
- /* SIO return codes */
- #define SIO_OK 0x01
- #define SIO_TIMEOUT 0x8A
- #define SIO_NAK 0x8B
- #define SIO_DEVDONE 0x90
-
- extern
- rsB00(), rsB01(), rsB02(), rsB03(), rsB04(), rsB05(), rsB06(), rsB07(),
- rsB08(), rsB09(), rsB0A(), rsB0B(),
-
- rsPIA00(), rsPIA01(), rsPIA02(), rsPIA03(),
-
- rsGTIA00(), rsGTIA01(), rsGTIA02(), rsGTIA03(),
- rsGTIA04(), rsGTIA05(), rsGTIA06(), rsGTIA07(),
- rsGTIA08(), rsGTIA09(), rsGTIA0A(), rsGTIA0B(),
- rsGTIA0C(), rsGTIA0D(), rsGTIA0E(), rsGTIA0F(),
- rsGTIA10(), rsGTIA11(), rsGTIA12(), rsGTIA13(),
- rsGTIA14(), rsGTIA15(), rsGTIA16(), rsGTIA17(),
- rsGTIA18(), rsGTIA19(), rsGTIA1A(), rsGTIA1B(),
- rsGTIA1C(), rsGTIA1D(), rsGTIA1E(), rsGTIA1F(),
-
- rsPOK00(), rsPOK01(), rsPOK02(), rsPOK03(),
- rsPOK04(), rsPOK05(), rsPOK06(), rsPOK07(),
- rsPOK08(), rsPOK09(), rsPOK0A(), rsPOK0B(),
- rsPOK0C(), rsPOK0D(), rsPOK0E(), rsPOK0F(),
-
- rsANT00(), rsANT01(), rsANT02(), rsANT03(),
- rsANT04(), rsANT05(), rsANT06(), rsANT07(),
- rsANT08(), rsANT09(), rsANT0A(), rsANT0B(),
- rsANT0C(), rsANT0D(), rsANT0E(), rsANT0F(),
-
- rsBXX(),
-
- wsB00(), wsB01(), wsB02(), wsB03(), wsB04(), wsB05(), wsB06(), wsB07(),
- wsB08(), wsB09(), wsB0A(), wsB0B(),
-
- wsPIA00(), wsPIA01(), wsPIA02(), wsPIA03(),
-
- wsGTIA00(), wsGTIA01(), wsGTIA02(), wsGTIA03(),
- wsGTIA04(), wsGTIA05(), wsGTIA06(), wsGTIA07(),
- wsGTIA08(), wsGTIA09(), wsGTIA0A(), wsGTIA0B(),
- wsGTIA0C(), wsGTIA0D(), wsGTIA0E(), wsGTIA0F(),
- wsGTIA10(), wsGTIA11(), wsGTIA12(), wsGTIA13(),
- wsGTIA14(), wsGTIA15(), wsGTIA16(), wsGTIA17(),
- wsGTIA18(), wsGTIA19(), wsGTIA1A(), wsGTIA1B(),
- wsGTIA1C(), wsGTIA1D(), wsGTIA1E(), wsGTIA1F(),
-
- wsPOK00(), wsPOK01(), wsPOK02(), wsPOK03(),
- wsPOK04(), wsPOK05(), wsPOK06(), wsPOK07(),
- wsPOK08(), wsPOK09(), wsPOK0A(), wsPOK0B(),
- wsPOK0C(), wsPOK0D(), wsPOK0E(), wsPOK0F(),
-
- wsANT00(), wsANT01(), wsANT02(), wsANT03(),
- wsANT04(), wsANT05(), wsANT06(), wsANT07(),
- wsANT08(), wsANT09(), wsANT0A(), wsANT0B(),
- wsANT0C(), wsANT0D(), wsANT0E(), wsANT0F(),
-
- wsDL0(), wsDL1(), wsDL2(), wsDL3(), wsDL4(), wsDL5(), wsDL6(), wsDL7(),
- wsDL8(), wsDL9(), wsDLA(), wsDLB(), wsDLC(), wsDLD(), wsDLE(), wsDLF(),
-
- wsBXX();
-
- extern enter_SIO(), vecSIO();
-
- extern Atari_Hook(), Atari_Unhook(), LAtariVBI();
- extern LAtariInt();
-
- extern oldKey(), KeyPatch(), semaJoy(), Joy0();
-
- /* array of pointers to 256 service routines */
- void (*Bread_service[81])() =
- {
- rsB00, rsB01, rsB02, rsB03, rsB04, rsB05, rsB06, rsB07,
- rsB08, rsB09, rsB0A, rsB0B,
-
- rsPIA00, rsPIA01, rsPIA02, rsPIA03,
-
- rsGTIA00, rsGTIA01, rsGTIA02, rsGTIA03,
- rsGTIA04, rsGTIA05, rsGTIA06, rsGTIA07,
- rsGTIA08, rsGTIA09, rsGTIA0A, rsGTIA0B,
- rsGTIA0C, rsGTIA0D, rsGTIA0E, rsGTIA0F,
- rsGTIA10, rsGTIA11, rsGTIA12, rsGTIA13,
- rsGTIA14, rsGTIA15, rsGTIA16, rsGTIA17,
- rsGTIA18, rsGTIA19, rsGTIA1A, rsGTIA1B,
- rsGTIA1C, rsGTIA1D, rsGTIA1E, rsGTIA1F,
-
- rsPOK00, rsPOK01, rsPOK02, rsPOK03,
- rsPOK04, rsPOK05, rsPOK06, rsPOK07,
- rsPOK08, rsPOK09, rsPOK0A, rsPOK0B,
- rsPOK0C, rsPOK0D, rsPOK0E, rsPOK0F,
-
- rsANT00, rsANT01, rsANT02, rsANT03,
- rsANT04, rsANT05, rsANT06, rsANT07,
- rsANT08, rsANT09, rsANT0A, rsANT0B,
- rsANT0C, rsANT0D, rsANT0E, rsANT0F,
-
- rsBXX
- };
-
- void (*Bwrite_service[97])() =
- {
- wsB00, wsB01, wsB02, wsB03, wsB04, wsB05, wsB06, wsB07,
- wsB08, wsB09, wsB0A, wsB0B,
-
- wsPIA00, wsPIA01, wsPIA02, wsPIA03,
-
- wsGTIA00, wsGTIA01, wsGTIA02, wsGTIA03,
- wsGTIA04, wsGTIA05, wsGTIA06, wsGTIA07,
- wsGTIA08, wsGTIA09, wsGTIA0A, wsGTIA0B,
- wsGTIA0C, wsGTIA0D, wsGTIA0E, wsGTIA0F,
- wsGTIA10, wsGTIA11, wsGTIA12, wsGTIA13,
- wsGTIA14, wsGTIA15, wsGTIA16, wsGTIA17,
- wsGTIA18, wsGTIA19, wsGTIA1A, wsGTIA1B,
- wsGTIA1C, wsGTIA1D, wsGTIA1E, wsGTIA1F,
-
- wsPOK00, wsPOK01, wsPOK02, wsPOK03,
- wsPOK04, wsPOK05, wsPOK06, wsPOK07,
- wsPOK08, wsPOK09, wsPOK0A, wsPOK0B,
- wsPOK0C, wsPOK0D, wsPOK0E, wsPOK0F,
-
- wsANT00, wsANT01, wsANT02, wsANT03,
- wsANT04, wsANT05, wsANT06, wsANT07,
- wsANT08, wsANT09, wsANT0A, wsANT0B,
- wsANT0C, wsANT0D, wsANT0E, wsANT0F,
-
- wsDL0, wsDL1, wsDL2, wsDL3, wsDL4, wsDL5, wsDL6, wsDL7,
- wsDL8, wsDL9, wsDLA, wsDLB, wsDLC, wsDLD, wsDLE, wsDLF,
-
- wsBXX
- };
-
- /* used for the sound emulation */
- char rgbSound[9];
-
- /* tells us if a disk drive is attached */
- int fDOS = FALSE;
- /* this is the DOS 2.0 disk emulation buffer */
- long lrgbDrive;
-
- extern long lFreeSpace;
-
- int fAtariXLROMs; /* Atari XL ROMs selected? */
- int fAtariXL; /* bank select hardware enabled? */
- int fFastIO; /* fast disk I/O? */
- int fFastFP; /* is Fastchip selected? */
- int fAtCart; /* is a cartridge plugged in */
- unsigned int uAtRAM; /* byte past end of RAM ($8000, $A000, $C000) */
- long lrgbXLRAM;
- int fXLRAM;
- int wVBIrate, wVBIcount;
-
- /* paths and names of 2 drive files */
- ATARIDRIVE rgAD[2];
-
- /* definitions of D1: and D2: */
- SECTOR *rgsectors[2];
- int fDDenable; /* enough memory to support DD? */
-
- /*************************************************************************/
-
- /* init Atari for the first time */
- init_atari()
- {
- int w;
- register ATARIDRIVE *pAD;
-
- w = Dgetdrv();
-
- pAD = &rgAD[0];
- pAD->rgchPath[0] = 'A' + w;
- pAD->rgchPath[1] = ':';
- Dgetpath(&pAD->rgchPath[2], 0);
- pAD->rgchName[0] = 0;
- pAD->mdDensity = 0;
-
- pAD++;
- pAD->rgchPath[0] = 'A' + w;
- pAD->rgchPath[1] = ':';
- Dgetpath(&pAD->rgchPath[2], 0);
- pAD->rgchName[0] = 0;
- pAD->mdDensity = 0;
-
- lrgbDrive = lFreeSpace;
- rgsectors[0] = (SECTOR *)lrgbDrive;
- rgsectors[1] = rgsectors[0] + 720;
-
- lrgbXLRAM = lRStat - 16384L;
- fXLRAM = 0;
-
- wVBIrate = 1;
- }
-
-
- /* initialize the stat arrays and set defaults for power on */
- setup_atari()
- {
- register unsigned ea;
- register int x,y;
- register char *qRStat = (char *)lRStat;
- register char *qWStat = (char *)lWStat;
- register int h;
-
- fRedraw = FALSE; /* let DL take care of it */
- fPMGRedraw = FALSE;
- fAtDMA = FALSE;
- mdAtWidth = 0;
- uAtCharBase = 0;
- bDMACTL = 0;
- mdAtWidth = 0;
- uDLStart = 0;
- wVBIcount = 0;
- fXLRAM = 0;
-
- /* clear sound regs */
- Blitzb(rgbSound, 9);
-
- /* clear color regs */
- Blitzb(rgwAtColors, 9);
-
- /* clear video display */
- Blitzl(lScr, 10240);
-
- /* clear out read stat array */
- Blitzl(qRStat - 32768L, 8192);
- /* write protect upper half of memory */
- Blitc(0x80, qWStat - 32768L, 32768);
- /* un-write protect lower half of memory */
- Blitc(0x00, qWStat, 32768);
-
- /* now set up RAM and ROM */
- if (fAtCart && (uAtRAM==49152))
- uAtRAM = 40960;
-
- if (uAtRAM > 32768)
- Blitc(0x00, qWStat - 32768L, uAtRAM - 32768);
-
- /* set status bytes for POKEY, ANTIC, PIA, and GTIA chips */
- {
- int i;
-
- if (fAtariXL) /* is bank switching enabled? */
- {
- for (i = 0; i < 16384; i++)
- {
- qWStat[0xFFFFC000+i] = 0x81;
- }
- }
-
- for (i=0; i<256; i++)
- {
- qRStat[0xFFFFD000+i] = 16 + (i & 0x1F); /* GTIA */
- qRStat[0xFFFFD200+i] = 48 + (i & 0x0F); /* POKEY */
- qRStat[0xFFFFD300+i] = 12 + (i & 0x03); /* PIA */
- qRStat[0xFFFFD400+i] = 64 + (i & 0x0F); /* ANTIC */
-
- qWStat[0xFFFFD000+i] = 0x80 + 16 + (i & 0x1F); /* GTIA */
- qWStat[0xFFFFD200+i] = 0x80 + 48 + (i & 0x0F); /* POKEY */
- qWStat[0xFFFFD300+i] = 0x80 + 12 + (i & 0x03); /* PIA */
- qWStat[0xFFFFD400+i] = 0x80 + 64 + (i & 0x0F); /* ANTIC */
- }
- }
-
- {
- int iHeap = 0;
- long lToRS, lToWS;
- long lFromRS, lFromWS, lNextRS, lNextWS;
- int iService = 0;
-
- /* blit the 81 read and 97 write routines */
- do
- {
- if (iService < 80)
- {
- lToRS = lEmul + iHeap + (int)iRead;
- lFromRS = (long)Bread_service[iService];
- lNextRS = (long)Bread_service[iService+1];
-
- Assert(((int)(lNextRS - lFromRS)) >= 0, "RS blitting negative");
- Assert(((int)(lNextRS - lFromRS)) != 0, "RS blitting 0");
- Assert(((int)(lNextRS - lFromRS)) < 128, "RS blitting >128");
-
- Blitb(lFromRS, lToRS, (int)(lNextRS - lFromRS));
- }
-
- lToWS = lEmul + iHeap + (int)iWrite;
- lFromWS = (long)Bwrite_service[iService];
- lNextWS = (long)Bwrite_service[iService+1];
-
- Assert(((int)(lNextWS - lFromWS)) >= 0, "WS blitting negative");
- Assert(((int)(lNextWS - lFromWS)) != 0, "WS blitting 0");
- Assert(((int)(lNextWS - lFromWS)) < 128, "WS blitting >128");
-
- Blitb(lFromWS, lToWS, (int)(lNextWS - lFromWS));
-
- #ifdef NDEBUG
- printf("%3d lEmul = $%5lx lToRS = $%5lx lToWS = $%5lx\n",
- iService, lEmul, lToRS, lToWS);
- #endif
- iHeap += 256;
- iService++;
- } while (iService != 96);
- }
-
- /* opcode $80 becomes the SIO entry point */
- Blitb(vecSIO, lEmul - 0x00008000L + 6L, 64);
-
- /* fill RAM with a random value ($AA) - mustn't be $FF */
- Blitc(0xAA, lMemory, 0xC000);
-
- /* fill hardware registers with $00 */
- Blitc(0, lMemory + (unsigned)0xD000, 0x0800);
-
- if (fAtCart)
- Blitb(LAtariBasic,lMemory + (unsigned)0xA000,8192);
-
- if (fAtariXLROMs)
- {
- Blitb(LAtariXL,lMemory+(unsigned)0xD800,10240);
- Blitb(LAtariXL2,lMemory+(unsigned)0xC000,4096);
- Poke (0xFC87, 0xEA); Poke (0xFC88, 0xEA); Poke (0xFC89, 0xEA);
- Poke (0xC410, 0xEA); Poke (0xC411, 0xEA); Poke (0xC412, 0xEA);
- Poke (0xEEFF, 0xEA); Poke (0xEF00, 0xEA); Poke (0xEF01, 0xEA);
- Poke (0xEF02, 0xEA); Poke (0xEF03, 0xEA);
- Poke (0xC30B, 0x4C); Poke (0xC30C, 0x27); Poke (0xC30D, 0xC3);
- Poke (0xC3AB, 0x4C); Poke (0xC3AC, 0xC4); Poke (0xC3AD, 0xC3);
- Poke (0xC4ED, 0xEA); Poke (0xC4EE, 0xEA); Poke (0xC4EF, 0xEA);
- Poke (0xC67B, 0x60);
- }
- else
- Blitb(LAtariFP,lMemory+(unsigned)0xD800,10240);
-
- if (fFastFP)
- Blitb(LFastFP,lMemory+(unsigned)0xD800,2048);
-
- /* patch SIO vector */
- h = Dpeek(0xE45A);
- Poke(h, 0x80);
- Poke(h+1, 0x60);
-
- pHookIn = Atari_Hook;
- pUnHook = Atari_Unhook;
-
- #ifdef NDEBUG
- printf("setup_atari(): pHookIn = $%5lx pUnHook = $%5lx\n",
- pHookIn, pUnHook);
- #endif
-
- /* install interrupt handler */
- *(int *)(lEmul + (lInterrupt)) = OP_JMP;
- *(long *)(lEmul + (lIntVec)) = (long)LAtariInt;
- }
-
- /*************************************************************************/
-
- DTA *qdta;
-
- /* load specified file */
- int atari_load(mdDrive)
- int mdDrive;
- {
- register char *pch;
- int h;
- long liDrive; /* for multiple drive support */
- ATARIDRIVE *qAD;
- long lcb;
-
- #ifdef NDEBUG
- printf("Atari_load()\n");
- printf("mdDrive = %d\n", mdDrive);
- #endif
-
- liDrive = ((mdDrive) ? (fDDenable ? 184320L : 92160L) : 0L);
-
- if (mdDrive == 0)
- fDOS = FALSE;
-
- qAD = &rgAD[mdDrive];
- qAD->mdDensity = 0;
-
- #ifdef NDEBUG
- printf("path = %s\n", qAD->rgchPath);
- printf("name = %s\n", qAD->rgchName);
- #endif
- qAD->rgchPath[70] = 0;
-
- pch = &qAD->rgchPath[0];
-
- if (pch[1] != ':' || pch[2] != '\\')
- return;
-
- pch += strlen(pch);
-
- while (--pch > &qAD->rgchPath[2])
- {
- if (*pch == '*' || *pch == '?')
- {
- while (*--pch != '\\')
- ;
- *pch = 0;
- break;
- }
- else if (*pch == '\\')
- break;
- }
- *++pch = 0;
- qAD->rgchPath[2] = '\\';
-
- Dsetdrv(qAD->rgchPath[0]-'A');
-
- if (Dsetpath(&qAD->rgchPath[2]) < 0)
- return;
-
- /* finally load a disk */
- h = Fopen(qAD->rgchName,0);
- if (h>=0)
- {
- lcb = Fread(h, mdDrive ? 92161L : 184321L, lrgbDrive + liDrive);
- Fclose(h);
- if (mdDrive == 0)
- fDOS = TRUE;
- if ((lcb == 184320L) && fDDenable)
- qAD->mdDensity = 3;
- else if (lcb == 92160L)
- qAD->mdDensity = 1;
- else
- {
- Bconout(2,7);
- qAD->mdDensity = 0;
- fDOS = FALSE;
- }
- }
- }
-
- /* save specified file */
- int atari_save(mdDrive)
- int mdDrive;
- {
- register char *pch;
- int h;
- long liDrive; /* for multiple drive support */
- ATARIDRIVE *qAD;
-
- #ifdef NDEBUG
- printf("Atari_save()\n");
- printf("mdDrive = %d\n", mdDrive);
- #endif
-
- liDrive = ((mdDrive) ? (fDDenable ? 184320L : 92160L) : 0L);
-
- qAD = &rgAD[mdDrive];
-
- #ifdef NDEBUG
- printf("path = %s\n", qAD->rgchPath);
- printf("name = %s\n", qAD->rgchName);
- #endif
- qAD->rgchPath[70] = 0;
-
- pch = &qAD->rgchPath[0];
-
- if (pch[1] != ':' || pch[2] != '\\')
- return;
-
- pch += strlen(pch);
-
- while (--pch > &qAD->rgchPath[2])
- {
- if (*pch == '*' || *pch == '?')
- {
- while (*--pch != '\\')
- ;
- *pch = 0;
- break;
- }
- else if (*pch == '\\')
- break;
- }
- *++pch = 0;
- qAD->rgchPath[2] = '\\';
-
- Dsetdrv(qAD->rgchPath[0]-'A');
-
- if (Dsetpath(&qAD->rgchPath[2]) < 0)
- return;
-
- /* finally save a disk */
- h = Fcreate(qAD->rgchName,0);
- if (h>=0)
- {
- if (qAD->mdDensity == 3)
- Fwrite(h, 184320L, lrgbDrive + liDrive);
- else
- Fwrite(h, 92160L, lrgbDrive + liDrive);
- Fclose(h);
- }
- }
-
- atari_dir(wDrive)
- register unsigned wDrive; /* 0 = D1: 1 = D2: */
- {
- register unsigned iFile;
- register unsigned cFiles = 1; /* init to 1 to skip title */
- register unsigned cSectors=0;
- register DIRENTRY *rgDirEntry = (DIRENTRY *)&rgsectors[wDrive][0x168];
- register rgch[20];
- int fDD=FALSE;
-
- Assert(wDrive < 2, "wDrive too large");
-
- printf("\033EDirectory of D%c:\n", wDrive + '1');
-
- if (rgAD[wDrive].mdDensity == 0)
- {
- printf("\n\nDisk drive is empty!!\n\n");
- goto LexitDir;
- }
- else if (rgAD[wDrive].mdDensity == 3)
- {
- fDD = TRUE;
- rgDirEntry = (DIRENTRY *)&rgsectors[wDrive][0x168 + 0x168];
- }
-
- if (free_secs(wDrive) == -1)
- {
- printf("\n\nDisk full or not a DOS disk\n\n");
- goto LexitDir;
- }
-
- for (iFile = 0; iFile<64; iFile++)
- {
- if (!(rgDirEntry->rgf & fInUse))
- continue;
-
- Blitb(rgDirEntry->rgchName, rgch, 11);
- rgch[11] = 0;
-
- printf("\033Y%c%c", 32 + 1 + cFiles%22, 32 + 2 + (cFiles/22)*24);
- printf("%11.11s %03d\n", rgch,
- rgDirEntry->cSizeL + 256*rgDirEntry->cSizeH);
- cSectors += rgDirEntry->cSizeL + 256*rgDirEntry->cSizeH;
- cFiles++;
- rgDirEntry++;
- if (fDD && ((iFile & 7) == 7))
- rgDirEntry += 8;
- }
- printf("\033Y%c%c", 32 + 24, 32);
- printf("%4d free sectors", free_secs(wDrive));
-
- if (fDD)
- printf(" double density");
-
- LexitDir:
- printf("\033Y%c%cPress any key to continue...", 32 + 24, 32 + 40);
- fflush(stdout);
- Bconin(2);
- }
-
- int free_secs(wDrive)
- int wDrive;
- {
- unsigned isec;
- unsigned csec=0;
-
- /* 0 - 0 = DOS 2.0 flag
- 1,2 - total sectors (707)
- 3,4 - number of unused sectors
- */
- if (rgAD[wDrive].mdDensity == 0)
- return 0;
-
- for (isec=1; isec<=719; isec++)
- {
- if (mark_sec(isec, -1, wDrive))
- csec++;
- }
- return csec;
- }
-
- int mark_sec(isec, md, wDrive)
- unsigned isec;
- int md, wDrive;
- {
- VTC *vtc = (VTC *)&rgsectors[wDrive][0x167];
- unsigned bOld;
-
- if (rgAD[wDrive].mdDensity == 3)
- vtc = (VTC *)&rgsectors[wDrive][0x167 + 0x167];
-
- bOld = (vtc->rgchBits[isec>>3] >> (7-(isec&0x7))) & 1;
-
- if (md == -1)
- return bOld;
-
- if (md == 1)
- vtc->rgchBits[isec>>3] |= (1 << (7-(isec&0x7)));
- else
- vtc->rgchBits[isec>>3] &= ~(1 << (7-(isec&0x7)));
-
- return bOld;
- }
-
- int addfile(wDrive)
- register int wDrive;
- {
- int iFile;
- int hFile;
- char *pchPath = rgAD[wDrive].rgchPath;
- char *pch = rgAD[wDrive].rgchName;
- unsigned secFree, secNext;
- long cch, csecFile;
- register DIRENTRY *rgDirEntry = (DIRENTRY *)&rgsectors[wDrive][0x168];
-
- for (iFile = 0; iFile<64; iFile++)
- {
- if ((rgDirEntry[iFile].rgf & 0x7F) == 0)
- break;
- }
-
- if (iFile == 64)
- {
- form_alert(1, "[0][ Directory full!! ][ OK ]");
- return;
- }
-
- secNext = 4;
- while (mark_sec(secNext,-1, wDrive) == 0)
- secNext++;
-
- #ifdef NDEBUG
- printf("Opening %s\n", pch);
- #endif
-
- if ((hFile = Fopen(pch,0)) < 0)
- {
- form_alert(1, "[0][ Couldn't open file ][ OK ]");
- return;
- }
-
- cch = Fseek(0L, hFile, 2);
- csecFile = (cch+124L)/125L;
- Fclose(hFile);
-
- if (csecFile > free_secs(wDrive))
- {
- form_alert(1, "[0][ File too large!! ][ OK ]");
- return;
- }
-
- #ifdef NDEBUG
- printf("File size = %ld\n", cch);
- #endif
-
- hFile = Fopen(pch,0);
-
- fn_expand(pch, rgDirEntry[iFile].rgchName);
- rgDirEntry[iFile].cSizeL = (unsigned char)(csecFile);
- rgDirEntry[iFile].cSizeH = (unsigned char)(csecFile >> 8);
- rgDirEntry[iFile].cStartL = (unsigned char)(secNext);
- rgDirEntry[iFile].cStartH = (unsigned char)(secNext >> 8);
- rgDirEntry[iFile].rgf = (fDos20 | fInUse);
-
- while (cch > 125L)
- {
- secFree = secNext;
- mark_sec(secFree,0, wDrive);
- while (mark_sec(secNext,-1, wDrive) == 0)
- secNext++;
-
- #ifdef NDEBUG
- printf("copying 125 bytes to sector %d, next free = %d\n",
- secFree, secNext);
- #endif
-
- secFree--;
- if (Fread(hFile, 125L, rgsectors[wDrive][secFree].rgchData) < 0)
- {
- form_alert(1, "[0][ Error reading!! ][ OK ]");
- }
- #ifdef NDEBUG
- printf("Data read at %06lx\n", rgsectors[wDrive][secFree].rgchData);
- printf("data = %02x %02x %02x %02x\n",
- rgsectors[wDrive][secFree].rgchData[0],
- rgsectors[wDrive][secFree].rgchData[1],
- rgsectors[wDrive][secFree].rgchData[2],
- rgsectors[wDrive][secFree].rgchData[3]);
- #endif
-
- rgsectors[wDrive][secFree].ucBytes = 125;
- rgsectors[wDrive][secFree].uFileNum = iFile;
- rgsectors[wDrive][secFree].uSectorL = secNext & 0xFF;
- rgsectors[wDrive][secFree].uSectorH = secNext >> 8;
- cch -= 125L;
- }
-
- #ifdef NDEBUG
- printf("copying %d bytes to last sector %d, next free = %d\n",
- (unsigned)cch, secFree, secNext);
- #endif
-
- secFree = secNext;
- mark_sec(secFree,0, wDrive);
- secFree--;
- Fread(hFile, cch, rgsectors[wDrive][secFree].rgchData);
- rgsectors[wDrive][secFree].ucBytes = (unsigned)cch;
- rgsectors[wDrive][secFree].uFileNum = iFile;
- rgsectors[wDrive][secFree].uSectorL = 0;
- rgsectors[wDrive][secFree].uSectorH = 0;
-
- /* update free sectors on disk */
- ((VTC *)&rgsectors[wDrive][0x167])->foo[3] = free_secs(wDrive) & 0xFF;
- ((VTC *)&rgsectors[wDrive][0x167])->foo[4] = (free_secs(wDrive) >> 8);
-
- Fclose(hFile);
-
- form_alert(1, "[0][ File transferred ][ OK ]");
- }
-
- /* convert filename in *.* format to ??????????? format */
- fn_expand(pch, rgchFile)
- char *pch, *rgchFile;
- {
- unsigned ich=0;
-
- Blitc(' ', rgchFile, 11);
-
- while (*pch != '.' && ich<8)
- {
- if (*pch == 0)
- return;
- rgchFile[ich++] = toupper(*pch++);
- }
-
- if (*pch != '.')
- return;
-
- ich = 8;
- pch++;
-
- while (*pch && ich<11)
- {
- rgchFile[ich++] = toupper(*pch++);
- }
- }
-
- char b484Sav;
-
- /* This hooks all the interrupt vectors and also does anything that should
- ** be done, like clearing console keys, etc.
- */
-
- Atari_Hook()
- {
- #ifdef NDEBUG
- printf("Atari_Hook()\n");
- #endif
-
- b484Sav = *(char *)0x0484L;
- *(char*)0x0484L &= ~3; /* disable keyclick */
-
- VBI_on(LAtariVBI);
- Install_Key();
-
- Setpalette(rgwAtColors);
- Poke (0xD01F,7);
- }
-
- Atari_Unhook()
- {
- Remove_Key();
- VBI_off();
- *(char*)0x0484L = b484Sav; /* enable keyclick */
-
- Setpalette(rgwPalette);
-
- #ifdef NDEBUG
- printf("Atari_UnHook()\n");
- #endif
- }
-
- Install_Key()
- {
- register long *qKbdvBase;
-
- qKbdvBase = (long *) Kbdvbase();
-
- asm
- {
- ; turn off mouse = Bconout(4,$12)
- move.w #0x12,-(A7)
- move.w #4,-(A7)
- move.w #3,-(A7)
- trap #13
- addq.l #6,A7
-
- ; get old keyboard vector
- move.l 32(qKbdvBase),oldKey
- lea KeyPatch,A1
- move.l A1,32(qKbdvBase)
-
- ; turn on joysticks = Bconout(4,$14)
- move.w #0x14,-(A7)
- move.w #4,-(A7)
- move.w #3,-(A7)
- trap #13
- addq.l #6,A7
- }
- }
-
- Remove_Key()
- {
- register long *qKbdvBase;
-
- qKbdvBase = (long *)Kbdvbase();
-
- asm {
- ; turn off joysticks = Bconout(4,$1A)
- move.w #0x1a,-(A7)
- move.w #4,-(A7)
- move.w #3,-(A7)
- trap #13
- addq.l #6,A7
-
- move.l oldKey,32(qKbdvBase) ; recover the old keyboard vector
-
- ; turn on mouse = Bconout(4,$8)
- move.w #0x8,-(A7)
- move.w #4,-(A7)
- move.w #3,-(A7)
- trap #13
- addq.l #6,A7
- }
- }
-
-
- /************************* End of init code ********************/
-
- enter_SIO()
- {
- int wDev, wDrive, wCom, wStat, wBuff, wBytes, wSector, bAux1, bAux2;
- int wRetStat = SIO_OK;
- long liDrive; /* for multiple drive support */
-
- #ifdef NDEBUG
- printf("\033HDevice ID = %2x\n", Peek(0x300));
- printf("Drive # = %2x\n", Peek(0x301));
- printf("Command = %2x\n", Peek(0x302));
- printf("SIO Command = %2x\n", Peek(0x303));
- printf("Buffer = %2x\n", Dpeek(0x304));
- printf("Timeout = %2x\n", Dpeek(0x306));
- printf("Byte count = %2x\n", Dpeek(0x308));
- printf("Sector = %2x\n", Dpeek(0x30A));
- printf("Aux1 = %2x\n", Peek(0x30A));
- printf("Aux2 = %2x\n", Peek(0x30B));
- #endif
-
- wDev = Peek(0x300);
- wDrive = Peek(0x301);
- wCom = Peek(0x302);
- wStat = Peek(0x303);
- wBuff = Dpeek(0x304);
- wBytes = Dpeek(0x308);
- wSector = Dpeek(0x30A)-1;
- bAux1 = Peek(0x30A);
- bAux2 = Peek(0x30B);
-
- switch (wDev)
- {
- default:
- #ifdef NDEBUG
- printf("SIO: wDev = %2x wCom = %2x wBytes = %2x\n",
- wDev, wCom, wBytes);
- printf("SIO: wBuff = %4x bAux1 = %2x bAux2 = %2x\n",
- wBuff, bAux1, bAux2);
- #endif
- wRetStat = SIO_TIMEOUT;
- break;
-
- case 0x40:
- {
- #ifdef NDEBUG
- printf("SIO: wDev = %2x wCom = %2x wBytes = %2x\n",
- wDev, wCom, wBytes);
- printf("SIO: wBuff = %4x bAux1 = %2x bAux2 = %2x\n",
- wBuff, bAux1, bAux2);
- #endif
- switch(wCom)
- {
- /* status request */
- case 'S':
- break;
-
- case 'W':
- /* print line */
- {
- int timeout;
- char *pchBuf = (char *)lMemory + (unsigned)wBuff;
- int cch = wBytes;
-
- while ((pchBuf[cch-1] == ' ') && (cch>0))
- cch--;
-
- while ((cch-- > 0) && (wRetStat == SIO_OK))
- {
- for (timeout = 1000; timeout > 0; timeout--)
- {
- if (Cprnos())
- { /* if printer is ready */
- if (*pchBuf != (char)0x9B)
- Cprnout (*pchBuf++); /* check for CR and print */
- else
- {
- pchBuf++;
- Cprnout(13);
- Cprnout(10);
- }
- wRetStat = SIO_OK;
- break;
- }
- wRetStat = SIO_TIMEOUT; /* else status = timeout error */
- }
- }
- }
- }
- }
- break;
-
- case 0x31:
- case 0x32:
- {
- int fDD = (rgAD[wDrive-1].mdDensity == 3);
-
- if (!fDOS || (rgAD[wDrive-1].mdDensity == 0))
- {
- wRetStat = 0x8A; /* device doesn't respond error */
- break;
- }
-
- liDrive = ((wDrive-1) ? (fDDenable ? 184320L : 92160L) : 0L);
-
- switch(wCom)
- {
- /* format enhanced density */
- case '"':
- wRetStat = SIO_NAK;
- break;
-
- case '!':
- if (rgAD[wDrive-1].fWP) /* is drive write-protected? */
- {
- wRetStat = SIO_DEVDONE;
- break;
- }
-
- /* "format" disk, just zero all sectors */
- Blitzl(lrgbDrive + liDrive, fDD ? 46080 : 23040);
- break;
-
- /* status request */
- case 'S':
- /* b7 = enhanced b5 = DD/SD b4 = motor on b3 = write prot */
- Poke (wBuff++, (fDD ? 32 : 0) + (rgAD[wDrive-1].fWP ? 8 : 0));
-
- Poke (wBuff++, 0xFF); /* controller */
- Poke (wBuff++, 0xE0); /* format timeout */
- Poke (wBuff, 0x00); /* unused */
- break;
-
- /* get configuration */
- case 'N':
- Poke (wBuff++, 0x28); /* tracks */
- Poke (wBuff++, 0x02); /* ?? */
- Poke (wBuff++, 0x00); /* ?? */
- Poke (wBuff++, 0x12); /* sectors/track */
- Poke (wBuff++, 0x00); /* ?? */
-
- if (rgAD[wDrive-1].mdDensity == 3)
- {
- Poke (wBuff++, 0x04); /* density: 4 = dbl 0 = sng */
- Poke (wBuff++, 0x01); /* bytes/sector hi */
- Poke (wBuff++, 0x00); /* bytes/sector lo */
- }
- else
- {
- Poke (wBuff++, 0x00); /* density: 4 = dbl 0 = sng */
- Poke (wBuff++, 0x00); /* bytes/sector hi */
- Poke (wBuff++, 0x80); /* bytes/sector lo */
- }
- Poke (wBuff++, 0xFF); /* unused */
- Poke (wBuff++, 0xFF); /* unused */
- Poke (wBuff++, 0xFF); /* unused */
- Poke (wBuff, 0xFF); /* unused */
- break;
-
- /* set configuration */
- case 'O':
- if (Peek(wBuff + 5) == 4)
- {
- rgAD[wDrive-1].mdDensity = 3;
- }
- else
- {
- rgAD[wDrive-1].mdDensity = 1;
- }
- break;
-
- case 'P':
- case 'W':
- /* write sector */
- Assert(wStat == 0x80, "write sector");
-
- if (rgAD[wDrive-1].fWP) /* is drive write-protected? */
- {
- wRetStat = SIO_DEVDONE;
- break;
- }
-
- if ((wSector<0) || (wSector >=720))
- {
- wRetStat = SIO_NAK;
- break;
- }
-
- if (fDD) /* assumes D1: */
- {
- Blitb(lMemory + (unsigned)(wBuff),
- lrgbDrive + (long)(wSector)*256L, wBytes);
- }
- else
- {
- Blitb(lMemory + (unsigned)(wBuff),
- lrgbDrive + liDrive + (long)(wSector)*128L, wBytes);
- }
-
- if (fFastIO)
- break;
- {
- /* simulate the time delay between sectors */
- int delay, sav4, sav5;
-
- /* simulate the beep beep write sound */
- sav4 = rgbSound[4];
- sav5 = rgbSound[5];
- rgbSound[4] = 80;
- rgbSound[5] = 0x66;
-
- for (delay = 0; delay<4000; delay++)
- ;
- rgbSound[4] = 0;
- rgbSound[5] = 0;
-
- for (delay = 0; delay<12000; delay++)
- ;
-
- rgbSound[4] = sav4;
- rgbSound[5] = sav5;
- }
- break;
-
- case 'R':
- /* read sector */
- Assert(wStat == 0x40, "read sector");
- if ((wSector<0) || (wSector >=720))
- {
- wRetStat = SIO_NAK;
- break;
- }
-
- if (fDD) /* assumes D1: */
- {
- Blitb(lrgbDrive + liDrive + (long)(wSector)*256L,
- lMemory + (unsigned)(wBuff), wBytes);
- }
- else
- {
- Blitb(lrgbDrive + liDrive + (long)(wSector)*128L,
- lMemory + (unsigned)(wBuff), wBytes);
- }
-
- if (fFastIO)
- break;
-
- {
- /* simulate the time delay between sectors */
- int delay, sav4, sav5;
-
- /* simulate the beep beep read sound */
- sav4 = rgbSound[4];
- sav5 = rgbSound[5];
- rgbSound[4] = 33;
- rgbSound[5] = 0xA8;
-
- for (delay = 0; delay<6000; delay++)
- ;
- rgbSound[4] = 0;
- rgbSound[5] = 0;
-
- if (fDD)
- for (delay = 0; delay<15000; delay++) ;
- else
- for (delay = 0; delay<6000; delay++) ;
-
- rgbSound[4] = sav4;
- rgbSound[5] = sav5;
- }
- break;
- }
- }
- }
- /* return status */
- Poke (0x303, wRetStat);
- #ifdef NDEBUG
- printf("Returning from SIO\n");
- #endif
- }
-
- /* this routine swaps the 14K of memory from $C000-$FFFF to simlate
- ** XL memory handling
- */
-
- swap_XL()
- {
- register long *pchMem, *pchBuf, *pchMem0;
- register long ch;
- register unsigned int u, i;
-
- pchMem = (long *)(lMemory + (unsigned)0xC000);
- pchBuf = (long *)(lrgbXLRAM - 16384L);
-
- asm
- {
- move.w #1023,i ; 1024 * 4 = 4096
- l1:
- move.l (pchMem),D0
- move.l (pchBuf),(pchMem)+
- move.l D0,(pchBuf)+
- dbf i,l1
-
- lea 2048(pchMem),pchMem
- lea 2048(pchBuf),pchBuf
-
- move.w #2559,i ; 2560 * 4 = 10240
- l2:
- move.l (pchMem),D0
- move.l (pchBuf),(pchMem)+
- move.l D0,(pchBuf)+
- dbf i,l2
- }
- }
-
- Atari()
- {
- asm {
-
- ; handler for SIO
- vecSIO:
- move.l arPC,drEA
- cmpi.w #0xC000,drEA
- bcs vecCIO2 ; if PC < $C000, abort SIO
-
- SAVEREGS
- jsr enter_SIO
- LOADREGS
-
- move.b #0,drA ; SIO clears A
- move.w #0x303,drEA
- move.l drEA,arEA
- move.b (arEA),drY ; Y = status
- move.b drY,drST ; set NZ flags
- ext.w drST
- DISPATCH
-
- vecCIO2:
- UNUSED
-
-
- ; handler for ROM, do nothing
- wsB00:
- addq.l #2,SP
- DISPATCH
-
- ; XL RAM handling ($C000-$FFFF)
- wsB01:
- move.w (SP)+,drDATA
-
- tst.b fXLRAM ; is ROM disabled
- beq.s wsB01_x ; no, so don't write
-
- move.l drEA,arEA
- move.b drDATA,(arEA)
- wsB01_x:
- DISPATCH
-
- wsB02:
- addq.l #2,SP
- DISPATCH
-
- wsB03:
- addq.l #2,SP
- DISPATCH
-
- ; player #1
- wsB04:
- move.w (SP)+,drDATA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsB04_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsB04_x:
- DISPATCH
-
- ; player #2
- wsB05:
- move.w (SP)+,drDATA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsB05_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsB05_x:
- DISPATCH
-
- ; player #3
- wsB06:
- move.w (SP)+,drDATA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsB06_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsB06_x:
- DISPATCH
-
- ; player #4
- wsB07:
- move.w (SP)+,drDATA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsB07_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsB07_x:
- DISPATCH
-
- wsB08:
- move.w (SP)+,drDATA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsB08_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsB08_x:
- DISPATCH
-
- wsB09:
- addq.l #2,SP
- DISPATCH
- wsB0A:
- addq.l #2,SP
- DISPATCH
- wsB0B:
- addq.l #2,SP
- DISPATCH
-
- ; PIA chip
-
- wsPIA00:
- addq.l #2,SP
- DISPATCH
-
- ; $D301 - XL PORT B or 400/800 joystick
- wsPIA01:
- move.w (SP)+,drDATA
- tst.w fAtariXL
- beq wsPIA01_x
- ori.w #0x00FC,drEA
- move.l drEA,arEA
- move.b drDATA,(arEA)
- move.b fXLRAM,drEA ; get old value of ~b0
- btst #0,drDATA ; test bank select bit
- seq fXLRAM ; if b0==0, OS ROM disabled
- seq drDATA
- cmp.b drDATA,drEA
- beq.s wsPIA01_x
- movem.l D0-D7/A0-A6,-(SP)
- jsr swap_XL ; go swap memory
- movem.l (SP)+,D0-D7/A0-A6
- nop
- wsPIA01_x:
- DISPATCH
-
- wsPIA02:
- addq.l #2,SP
- DISPATCH
-
- wsPIA03:
- addq.l #2,SP
- DISPATCH
-
- ; GTIA chip
-
- wsGTIA00:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA00_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsGTIA00_x:
- DISPATCH
-
- wsGTIA01:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA01_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsGTIA01_x:
- DISPATCH
-
- wsGTIA02:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA02_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsGTIA02_x:
- DISPATCH
-
- wsGTIA03:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA03_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsGTIA03_x:
- DISPATCH
-
- wsGTIA04:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA04_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsGTIA04_x:
- DISPATCH
-
- wsGTIA05:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA05_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsGTIA05_x:
- DISPATCH
-
- wsGTIA06:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA06_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsGTIA06_x:
- DISPATCH
-
- wsGTIA07:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA07_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsGTIA07_x:
- DISPATCH
-
- wsGTIA08:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA08_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsGTIA08_x:
- DISPATCH
-
- wsGTIA09:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA09_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsGTIA09_x:
- DISPATCH
-
- wsGTIA0A:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA0A_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsGTIA0A_x:
- DISPATCH
-
- wsGTIA0B:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA0B_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsGTIA0B_x:
- DISPATCH
-
- wsGTIA0C:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA0C_x
- move.b drDATA,(arEA)
- wsGTIA0C_x:
- DISPATCH
-
- wsGTIA0D:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA0D_x
- move.b drDATA,(arEA)
- wsGTIA0D_x:
- DISPATCH
-
- wsGTIA0E:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA0E_x
- move.b drDATA,(arEA)
- wsGTIA0E_x:
- DISPATCH
-
- wsGTIA0F:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA0F_x
- move.b drDATA,(arEA)
- wsGTIA0F_x:
- DISPATCH
-
- wsGTIA10:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA10_x
- move.b drDATA,(arEA)
- wsGTIA10_x:
- DISPATCH
-
- wsGTIA11:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA11_x
- move.b drDATA,(arEA)
- wsGTIA11_x:
- DISPATCH
-
- wsGTIA12:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA12_x
- move.b drDATA,(arEA)
- wsGTIA12_x:
- DISPATCH
-
- wsGTIA13:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA13_x
- move.b drDATA,(arEA)
- wsGTIA13_x:
- DISPATCH
-
- wsGTIA14:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA14_x
- move.b drDATA,(arEA)
- wsGTIA14_x:
- DISPATCH
-
- wsGTIA15:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA15_x
- move.b drDATA,(arEA)
- wsGTIA15_x:
- DISPATCH
-
- ; $D016 - COLPF0 - playfield color 0
- wsGTIA16:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA16_x
- move.b drDATA,(arEA)
-
- tst.w fIsMono
- bne.s wsGTIA16_x
- lea rgwRainbow,arEA
- andi.w #0xFE,drDATA
- move.w 0(arEA,drDATA.w),drDATA
- move.w drDATA,rgwAtColors+2
- move.w drDATA,0x8242
- wsGTIA16_x:
- DISPATCH
-
- ; $D017 - COLPF1 - playfield color 1
- wsGTIA17:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA17_x
- move.b drDATA,(arEA)
-
- tst.w fIsMono
- bne.s wsGTIA17_x
- move.b 1(arEA),-(SP) ; get background color
- lea rgwRainbow,arEA
- andi.w #0xFE,drDATA
- move.w drDATA,drEA
- move.w 0(arEA,drDATA.w),drDATA
- move.w drDATA,rgwAtColors+4
- move.w drDATA,0x8244
- move.b (SP)+,drDATA ; get background color
- andi.w #0x000E,drEA
- andi.w #0x00F0,drDATA
- or.w drEA,drDATA
- move.w 0(arEA,drDATA.w),drDATA
- move.w drDATA,rgwAtColors+14
- move.w drDATA,0x824E
- wsGTIA17_x:
- DISPATCH
-
- ; $D018 - COLPF2 - playfield color 2
- wsGTIA18:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA18_x
- move.b drDATA,(arEA)
-
- tst.w fIsMono
- bne.s wsGTIA18_x
- move.b -1(arEA),-(SP) ; get foreground color
- lea rgwRainbow,arEA
- andi.w #0xFE,drDATA
- move.w drDATA,drEA
- move.w 0(arEA,drDATA.w),drDATA
- move.w drDATA,rgwAtColors+6
- move.w drDATA,0x8246
- move.b (SP)+,drDATA ; get foreground color
- andi.w #0x00F0,drEA
- andi.w #0x000E,drDATA
- or.w drEA,drDATA
- move.w 0(arEA,drDATA.w),drDATA
- move.w drDATA,rgwAtColors+14
- move.w drDATA,0x824E
- wsGTIA18_x:
- DISPATCH
-
- ; $D019 - COLPF3 - playfield color 3
- wsGTIA19:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA19_x
- move.b drDATA,(arEA)
-
- tst.w fIsMono
- bne.s wsGTIA19_x
- lea rgwRainbow,arEA
- andi.w #0xFE,drDATA
- move.w 0(arEA,drDATA.w),drDATA
- move.w drDATA,rgwAtColors+8
- move.w drDATA,0x8248
- wsGTIA19_x:
- DISPATCH
-
- ; $D01A - COLBK - background color
- wsGTIA1A:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA1A_x
- move.b drDATA,(arEA)
-
- tst.w fIsMono
- bne.s wsGTIA1A_x
-
- lea rgwRainbow,arEA
- andi.w #0xFE,drDATA
- move.w 0(arEA,drDATA.w),drDATA
- move.w drDATA,rgwAtColors+0
- move.w drDATA,0x8240
- wsGTIA1A_x:
- DISPATCH
-
- wsGTIA1B:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA1B_x
- move.b drDATA,(arEA)
- wsGTIA1B_x:
- DISPATCH
-
- wsGTIA1C:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA1C_x
- move.b drDATA,(arEA)
- wsGTIA1C_x:
- DISPATCH
-
- ; $D01D - GRACTL
- wsGTIA1D:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA1D_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsGTIA1D_x:
- DISPATCH
-
- wsGTIA1E:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA1E_x
- move.b drDATA,(arEA)
- wsGTIA1E_x:
- DISPATCH
-
- ; $D01F - speaker
- wsGTIA1F:
- move.w (SP)+,drDATA
- ori.w #0x00E0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsGTIA1F_x
- move.b drDATA,(arEA)
-
- bra wsGTIA1F_x ; diasble keycicks for now ~~~
-
- lea 0x8800,arEA
- btst #3,drDATA
- bne.s wsGTIA1F0 ; bit on = speaker off
-
- move.b #10,(arEA)
- move.b #0x0F,(arEA) ; set C volume = $F
- move.b #7,(arEA)
- move.b (arEA),drDATA
- andi.b #0xDF,drDATA
- move.b drDATA,2(arEA) ; enable C noise
- wsGTIA1F_x:
- DISPATCH
-
- wsGTIA1F0:
- move.b #10,(arEA)
- move.b #0x00,(arEA) ; set C volume = $0
- move.b #7,(arEA)
- move.b (arEA),drDATA
- ori.b #0x24,drDATA
- move.b drDATA,2(arEA) ; disable C
- DISPATCH
-
- ; POKEY chip
-
- ; $D200-$D208 - sound registers, handled by VBI
- wsPOK00:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsPOK00_x
- move.b drDATA,(arEA)
- move.b drDATA,rgbSound
- wsPOK00_x:
- DISPATCH
-
- wsPOK01:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsPOK01_x
- move.b drDATA,(arEA)
- move.b drDATA,rgbSound+1
- wsPOK01_x:
- DISPATCH
-
- wsPOK02:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsPOK02_x
- move.b drDATA,(arEA)
- move.b drDATA,rgbSound+2
- wsPOK02_x:
- DISPATCH
-
- wsPOK03:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsPOK03_x
- move.b drDATA,(arEA)
- move.b drDATA,rgbSound+3
- wsPOK03_x:
- DISPATCH
-
- wsPOK04:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsPOK04_x
- move.b drDATA,(arEA)
- move.b drDATA,rgbSound+4
- wsPOK04_x:
- DISPATCH
-
- wsPOK05:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsPOK05_x
- move.b drDATA,(arEA)
- move.b drDATA,rgbSound+5
- wsPOK05_x:
- DISPATCH
-
- wsPOK06:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsPOK06_x
- move.b drDATA,(arEA)
- move.b drDATA,rgbSound+6
- wsPOK06_x:
- DISPATCH
-
- wsPOK07:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsPOK07_x
- move.b drDATA,(arEA)
- move.b drDATA,rgbSound+7
- wsPOK07_x:
- DISPATCH
-
- wsPOK08:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsPOK08_x
- move.b drDATA,(arEA)
- move.b drDATA,rgbSound+8
- wsPOK08_x:
- DISPATCH
-
- ; $D209 - STIMER
- wsPOK09:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsPOK09_x
- move.b drDATA,(arEA)
- move.b drDATA,rgbSound+8
- wsPOK09_x:
- DISPATCH
-
- ; $D20A - a write to this location sets bits 7, 6, 5 of serial/key status $D20F
- ; for now, set all 6 unused bits, (bits 3 = shift key, bit 2 = any key)
- wsPOK0A:
- addq.l #2,SP
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- ori.b #0xF3,5(arEA)
- DISPATCH
-
- wsPOK0B:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsPOK0B_x
- move.b drDATA,(arEA)
- wsPOK0B_x:
- DISPATCH
-
- wsPOK0C:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsPOK0C_x
- move.b drDATA,(arEA)
- wsPOK0C_x:
- DISPATCH
-
- wsPOK0D:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsPOK0D_x
- move.b drDATA,(arEA)
- wsPOK0D_x:
- DISPATCH
-
- ; $D20E - IRQ enable
- wsPOK0E:
- move.w (SP)+,drDATA
- move.b drDATA,bIRQmask(arEMUL) ; store IRQ enable
- and.b bIRQ(arEMUL),drDATA
- move.b drDATA,bIRQ(arEMUL) ; clear IRQ interrupts
- DISPATCH
-
- wsPOK0F:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsPOK0F_x
- move.b drDATA,(arEA)
- wsPOK0F_x:
- DISPATCH
-
- ; ANTIC chip
-
- ; $D400 - DMACTL
- ; bits 0 and 1 control playfield width
- ; bit 5 = DMA control
- ; if value == 0 then clear video display
- wsANT00:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsANT00_x
- move.b drDATA,(arEA)
- beq.s wsANT00_clr
- btst #5,drDATA
- sne fAtDMA
- andi.w #0x03,drDATA
- move.w drDATA,mdAtWidth
- st fRedraw
- wsANT00_x:
- DISPATCH
- wsANT00_clr:
- move.w #5119,drDATA
- move.l lScr,arEA
- wsANT00_2:
- clr.l (arEA)+
- clr.l (arEA)+
- dbf drDATA,wsANT00_2
- sf fAtDMA
- clr.w mdAtWidth
- DISPATCH
-
- wsANT01:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsANT01_x
- move.b drDATA,(arEA)
- wsANT01_x:
- DISPATCH
-
- ; $D402 - DL base address lo byte
- wsANT02:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsANT02_x
- move.b drDATA,(arEA)
- cmp.b uDLStart+1,drDATA
- beq.s wsANT02_x
- move.b drDATA,uDLStart+1
- tst.b uDLStart
- beq.s wsANT02_x
- st fRedraw
- wsANT02_x:
- DISPATCH
-
- ; $D403 - DL base address hi byte
- wsANT03:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsANT03_x
- move.b drDATA,(arEA)
- cmp.b uDLStart,drDATA
- beq.s wsANT03_x
- move.b drDATA,uDLStart
- beq.s wsANT03_x
- st fRedraw
- wsANT03_x:
- DISPATCH
-
- wsANT04:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsANT04_x
- move.b drDATA,(arEA)
- wsANT04_x:
- DISPATCH
-
- wsANT05:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsANT05_x
- move.b drDATA,(arEA)
- wsANT05_x:
- DISPATCH
-
- wsANT06:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsANT06_x
- move.b drDATA,(arEA)
- wsANT06_x:
- DISPATCH
-
- ; $D407 - PMBASE
- wsANT07:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsANT07_x
- move.b drDATA,(arEA)
- st fPMGRedraw
- wsANT07_x:
- DISPATCH
-
- wsANT08:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsANT08_x
- move.b drDATA,(arEA)
- wsANT08_x:
- DISPATCH
-
- ; $D409 - CHBASE
- wsANT09:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- andi.w #0xFE,drDATA
- cmp.b (arEA),drDATA
- beq.s wsANT09_x
- move.b drDATA,(arEA)
- cmp.b uAtCharBase,drDATA
- beq.s wsANT09_x
- move.b drDATA,uAtCharBase
- st fRedraw
- wsANT09_x:
- DISPATCH
-
- ; $D40A - WSYNC
- wsANT0A:
- addq.l #2,SP
- muls D0,D0
- muls D0,D0
- muls D0,D0
- DISPATCH
-
- wsANT0B:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsANT0B_x
- move.b drDATA,(arEA)
- wsANT0B_x:
- DISPATCH
-
- wsANT0C:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsANT0C_x
- move.b drDATA,(arEA)
- wsANT0C_x:
- DISPATCH
-
- wsANT0D:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsANT0D_x
- move.b drDATA,(arEA)
- wsANT0D_x:
- DISPATCH
-
- ; $D40E - NMI enable
- wsANT0E:
- move.w (SP)+,drDATA
- ori.w #0x00F0,drEA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsANT0E_x
- andi.w #0xC0,drDATA ; only bits 6 and 7 used
- move.b drDATA,(arEA) ;
- wsANT0E_x:
- DISPATCH
-
- wsANT0F:
- clr.b bNMI(arEMUL) ; clear NMIST
- addq.l #2,SP
- DISPATCH
-
- ; DL list routines
- ; 0 - unused
- ; 1 - DL byte, when modified, sets fRedraw flag
- ; 2..$F - ANTIC mode emulation
-
- wsDL0:
- addq.l #2,SP
- DISPATCH
-
- ; handler for display list
- wsDL1:
- move.w (SP)+,drDATA
- move.l drEA,arEA
- cmp.b (arEA),drDATA
- beq.s wsDL1_2
- st fRedraw
- move.b drDATA,(arEA)
- wsDL1_2:
- DISPATCH
-
- ; handler for ANTIC mode 2
- wsDL2:
- move.w (SP)+,drDATA
- movem.l D0-D7/A0-A6,-(SP)
- move.l drEA,arEA
- cmp.b (arEA),drDATA ; compare with byte in memory
- beq wsDL2_exit ; if same, just exit
-
- move.b drDATA,(arEA) ; store new byte to memory
- tst.w fRedraw ; if redraw flag, exit
- bne wsDL2_exit
-
- move.w #1,-(SP) ; count of characters
- move.l arEA,-(SP) ; pointer character to plot
-
- lea rgDL2,arEA ; get start of DL structure
- lNext2_1:
- move.l (arEA)+,drDATA ; get start[31:16] and ending[15:0] address
- cmp.w drDATA,drEA ; is EA < end
- bcc lNext2_2 ; no, next
-
- swap drDATA ; get start
- cmp.w drDATA,drEA ; is EA >= start
- bcs lNext2_2 ; no, next
-
- sub.w drDATA,drEA ; convert EA to (0-999)
- move.w drEA,-(SP)
- move.w (arEA),-(SP) ; get scan line offset
- jsr plot_2 ; go plot a text character
- lea 10(SP),SP
- bra wsDL2_exit
-
- lNext2_2:
- move.w (arEA)+,drDATA
- bpl lNext2_1 ; next, if not end of list
- addq.l #6,SP
-
- wsDL2_exit:
- movem.l (SP)+,D0-D7/A0-A6
- DISPATCH
-
- ; handler for ANTIC mode 3
- wsDL3:
- move.w (SP)+,drDATA
- movem.l D0-D7/A0-A6,-(SP)
- move.l drEA,arEA
- cmp.b (arEA),drDATA ; compare with byte in memory
- beq wsDL3_exit ; if same, just exit
-
- move.b drDATA,(arEA) ; store new byte to memory
- tst.w fRedraw ; if redraw flag, exit
- bne wsDL3_exit
-
- move.w #1,-(SP) ; count of characters
- move.l arEA,-(SP) ; pointer character to plot
-
- lea rgDL3,arEA ; get start of DL structure
- lNext3_1:
- move.l (arEA)+,drDATA ; get start[31:16] and ending[15:0] address
- cmp.w drDATA,drEA ; is EA < end
- bcc lNext3_2 ; no, next
-
- swap drDATA ; get start
- cmp.w drDATA,drEA ; is EA >= start
- bcs lNext3_2 ; no, next
-
- sub.w drDATA,drEA ; convert EA to (0-999)
- move.w drEA,-(SP)
- move.w (arEA),-(SP) ; get scan line offset
- jsr plot_3 ; go plot a text character
- lea 10(SP),SP
- bra wsDL3_exit
-
- lNext3_2:
- move.w (arEA)+,drDATA
- bpl lNext3_1 ; next, if not end of list
- addq.l #6,SP
-
- wsDL3_exit:
- movem.l (SP)+,D0-D7/A0-A6
- DISPATCH
-
- ; handler for ANTIC mode 4
- wsDL4:
- move.w (SP)+,drDATA
- movem.l D0-D7/A0-A6,-(SP)
- move.l drEA,arEA
- cmp.b (arEA),drDATA ; compare with byte in memory
- beq wsDL4_exit ; if same, just exit
-
- move.b drDATA,(arEA) ; store new byte to memory
- tst.w fRedraw ; if redraw flag, exit
- bne wsDL4_exit
-
- move.w #1,-(SP) ; count of characters
- move.l arEA,-(SP) ; pointer character to plot
-
- lea rgDL4,arEA ; get start of DL structure
- lNext4_1:
- move.l (arEA)+,drDATA ; get start[41:16] and ending[15:0] address
- cmp.w drDATA,drEA ; is EA < end
- bcc lNext4_2 ; no, next
-
- swap drDATA ; get start
- cmp.w drDATA,drEA ; is EA >= start
- bcs lNext4_2 ; no, next
-
- sub.w drDATA,drEA ; convert EA to (0-999)
- move.w drEA,-(SP)
- move.w (arEA),-(SP) ; get scan line offset
- jsr plot_4 ; go plot a text character
- lea 10(SP),SP
- bra wsDL4_exit
-
- lNext4_2:
- move.w (arEA)+,drDATA
- bpl lNext4_1 ; next, if not end of list
- addq.l #6,SP
-
- wsDL4_exit:
- movem.l (SP)+,D0-D7/A0-A6
- DISPATCH
-
- ; handler for ANTIC mode 5
- wsDL5:
- move.w (SP)+,drDATA
- movem.l D0-D7/A0-A6,-(SP)
- move.l drEA,arEA
- cmp.b (arEA),drDATA ; compare with byte in memory
- beq wsDL5_exit ; if same, just exit
-
- move.b drDATA,(arEA) ; store new byte to memory
- tst.w fRedraw ; if redraw flag, exit
- bne wsDL5_exit
-
- move.w #1,-(SP) ; count of characters
- move.l arEA,-(SP) ; pointer character to plot
-
- lea rgDL5,arEA ; get start of DL structure
- lNext5_1:
- move.l (arEA)+,drDATA ; get start[51:16] and ending[15:0] address
- cmp.w drDATA,drEA ; is EA < end
- bcc lNext5_2 ; no, next
-
- swap drDATA ; get start
- cmp.w drDATA,drEA ; is EA >= start
- bcs lNext5_2 ; no, next
-
- sub.w drDATA,drEA ; convert EA to (0-999)
- move.w drEA,-(SP)
- move.w (arEA),-(SP) ; get scan line offset
- jsr plot_5 ; go plot a text character
- lea 10(SP),SP
- bra wsDL5_exit
-
- lNext5_2:
- move.w (arEA)+,drDATA
- bpl lNext5_1 ; next, if not end of list
- addq.l #6,SP
-
- wsDL5_exit:
- movem.l (SP)+,D0-D7/A0-A6
- DISPATCH
-
- ; handler for ANTIC mode 6
- wsDL6:
- move.w (SP)+,drDATA
- movem.l D0-D7/A0-A6,-(SP)
- move.l drEA,arEA
- cmp.b (arEA),drDATA ; compare with byte in memory
- beq wsDL6_exit ; if same, just exit
-
- move.b drDATA,(arEA) ; store new byte to memory
- tst.w fRedraw ; if redraw flag, exit
- bne wsDL6_exit
-
- move.w #1,-(SP) ; count of characters
- move.l arEA,-(SP) ; pointer character to plot
-
- lea rgDL6,arEA ; get start of DL structure
- lNext6_1:
- move.l (arEA)+,drDATA ; get start[61:16] and ending[15:0] address
- cmp.w drDATA,drEA ; is EA < end
- bcc lNext6_2 ; no, next
-
- swap drDATA ; get start
- cmp.w drDATA,drEA ; is EA >= start
- bcs lNext6_2 ; no, next
-
- sub.w drDATA,drEA ; convert EA to (0-999)
- move.w drEA,-(SP)
- move.w (arEA),-(SP) ; get scan line offset
- jsr plot_6 ; go plot a text character
- lea 10(SP),SP
- bra wsDL6_exit
-
- lNext6_2:
- move.w (arEA)+,drDATA
- bpl lNext6_1 ; next, if not end of list
- addq.l #6,SP
-
- wsDL6_exit:
- movem.l (SP)+,D0-D7/A0-A6
- DISPATCH
-
- ; handler for ANTIC mode 7
- wsDL7:
- move.w (SP)+,drDATA
- movem.l D0-D7/A0-A6,-(SP)
- move.l drEA,arEA
- cmp.b (arEA),drDATA ; compare with byte in memory
- beq wsDL7_exit ; if same, just exit
-
- move.b drDATA,(arEA) ; store new byte to memory
- tst.w fRedraw ; if redraw flag, exit
- bne wsDL7_exit
-
- move.w #1,-(SP) ; count of characters
- move.l arEA,-(SP) ; pointer character to plot
-
- lea rgDL7,arEA ; get start of DL structure
- lNext7_1:
- move.l (arEA)+,drDATA ; get start[71:16] and ending[15:0] address
- cmp.w drDATA,drEA ; is EA < end
- bcc lNext7_2 ; no, next
-
- swap drDATA ; get start
- cmp.w drDATA,drEA ; is EA >= start
- bcs lNext7_2 ; no, next
-
- sub.w drDATA,drEA ; convert EA to (0-999)
- move.w drEA,-(SP)
- move.w (arEA),-(SP) ; get scan line offset
- jsr plot_7 ; go plot a text character
- lea 10(SP),SP
- bra wsDL7_exit
-
- lNext7_2:
- move.w (arEA)+,drDATA
- bpl lNext7_1 ; next, if not end of list
- addq.l #6,SP
-
- wsDL7_exit:
- movem.l (SP)+,D0-D7/A0-A6
- DISPATCH
-
- ; handler for ANTIC mode 8
- wsDL8:
- move.w (SP)+,drDATA
- movem.l D0-D7/A0-A6,-(SP)
- move.l drEA,arEA
- cmp.b (arEA),drDATA ; compare with byte in memory
- beq wsDL8_exit ; if same, just exit
-
- move.b drDATA,(arEA) ; store new byte to memory
- tst.w fRedraw ; if redraw flag, exit
- bne wsDL8_exit
-
- move.w #1,-(SP) ; count of characters
- move.l arEA,-(SP) ; pointer character to plot
-
- lea rgDL8,arEA ; get start of DL structure
- lNext8_1:
- move.l (arEA)+,drDATA ; get start[81:16] and ending[15:0] address
- cmp.w drDATA,drEA ; is EA < end
- bcc lNext8_2 ; no, next
-
- swap drDATA ; get start
- cmp.w drDATA,drEA ; is EA >= start
- bcs lNext8_2 ; no, next
-
- sub.w drDATA,drEA ; convert EA to (0-999)
- move.w drEA,-(SP)
- move.w (arEA),-(SP) ; get scan line offset
- jsr plot_8 ; go plot a text character
- lea 10(SP),SP
- bra wsDL8_exit
-
- lNext8_2:
- move.w (arEA)+,drDATA
- bpl lNext8_1 ; next, if not end of list
- addq.l #6,SP
-
- wsDL8_exit:
- movem.l (SP)+,D0-D7/A0-A6
- DISPATCH
-
- ; handler for ANTIC mode 9
- wsDL9:
- move.w (SP)+,drDATA
- movem.l D0-D7/A0-A6,-(SP)
- move.l drEA,arEA
- cmp.b (arEA),drDATA ; compare with byte in memory
- beq wsDL9_exit ; if same, just exit
-
- move.b drDATA,(arEA) ; store new byte to memory
- tst.w fRedraw ; if redraw flag, exit
- bne wsDL9_exit
-
- move.w #1,-(SP) ; count of characters
- move.l arEA,-(SP) ; pointer character to plot
-
- lea rgDL9,arEA ; get start of DL structure
- lNext9_1:
- move.l (arEA)+,drDATA ; get start[91:16] and ending[15:0] address
- cmp.w drDATA,drEA ; is EA < end
- bcc lNext9_2 ; no, next
-
- swap drDATA ; get start
- cmp.w drDATA,drEA ; is EA >= start
- bcs lNext9_2 ; no, next
-
- sub.w drDATA,drEA ; convert EA to (0-999)
- move.w drEA,-(SP)
- move.w (arEA),-(SP) ; get scan line offset
- jsr plot_9 ; go plot a text character
- lea 10(SP),SP
- bra wsDL9_exit
-
- lNext9_2:
- move.w (arEA)+,drDATA
- bpl lNext9_1 ; next, if not end of list
- addq.l #6,SP
-
- wsDL9_exit:
- movem.l (SP)+,D0-D7/A0-A6
- DISPATCH
-
- ; handler for ANTIC mode A
- wsDLA:
- move.w (SP)+,drDATA
- movem.l D0-D7/A0-A6,-(SP)
- move.l drEA,arEA
- cmp.b (arEA),drDATA ; compare with byte in memory
- beq wsDLA_exit ; if same, just exit
-
- move.b drDATA,(arEA) ; store new byte to memory
- tst.w fRedraw ; if redraw flag, exit
- bne wsDLA_exit
-
- move.w #1,-(SP) ; count of characters
- move.l arEA,-(SP) ; pointer character to plot
-
- lea rgDLA,arEA ; get start of DL structure
- lNextA_1:
- move.l (arEA)+,drDATA ; get start[A1:16] and ending[15:0] address
- cmp.w drDATA,drEA ; is EA < end
- bcc lNextA_2 ; no, next
-
- swap drDATA ; get start
- cmp.w drDATA,drEA ; is EA >= start
- bcs lNextA_2 ; no, next
-
- sub.w drDATA,drEA ; convert EA to (0-999)
- move.w drEA,-(SP)
- move.w (arEA),-(SP) ; get scan line offset
- jsr plot_A ; go plot a text character
- lea 10(SP),SP
- bra wsDLA_exit
-
- lNextA_2:
- move.w (arEA)+,drDATA
- bpl lNextA_1 ; next, if not end of list
- addq.l #6,SP
-
- wsDLA_exit:
- movem.l (SP)+,D0-D7/A0-A6
- DISPATCH
-
- ; handler for ANTIC mode B
- wsDLB:
- move.w (SP)+,drDATA
- movem.l D0-D7/A0-A6,-(SP)
- move.l drEA,arEA
- cmp.b (arEA),drDATA ; compare with byte in memory
- beq wsDLB_exit ; if same, just exit
-
- move.b drDATA,(arEA) ; store new byte to memory
- tst.w fRedraw ; if redraw flag, exit
- bne wsDLB_exit
-
- move.w #1,-(SP) ; count of characters
- move.l arEA,-(SP) ; pointer character to plot
-
- lea rgDLB,arEA ; get start of DL structure
- lNextB_1:
- move.l (arEA)+,drDATA ; get start[B1:16] and ending[15:0] address
- cmp.w drDATA,drEA ; is EA < end
- bcc lNextB_2 ; no, next
-
- swap drDATA ; get start
- cmp.w drDATA,drEA ; is EA >= start
- bcs lNextB_2 ; no, next
-
- sub.w drDATA,drEA ; convert EA to (0-999)
- move.w drEA,-(SP)
- move.w (arEA),-(SP) ; get scan line offset
- jsr plot_B ; go plot a text character
- lea 10(SP),SP
- bra wsDLB_exit
-
- lNextB_2:
- move.w (arEA)+,drDATA
- bpl lNextB_1 ; next, if not end of list
- addq.l #6,SP
-
- wsDLB_exit:
- movem.l (SP)+,D0-D7/A0-A6
- DISPATCH
-
- ; handler for ANTIC mode C
- wsDLC:
- move.w (SP)+,drDATA
- movem.l D0-D7/A0-A6,-(SP)
- move.l drEA,arEA
- cmp.b (arEA),drDATA ; compare with byte in memory
- beq wsDLC_exit ; if same, just exit
-
- move.b drDATA,(arEA) ; store new byte to memory
- tst.w fRedraw ; if redraw flag, exit
- bne wsDLC_exit
-
- move.w #1,-(SP) ; count of characters
- move.l arEA,-(SP) ; pointer character to plot
-
- lea rgDLC,arEA ; get start of DL structure
- lNextC_1:
- move.l (arEA)+,drDATA ; get start[C1:16] and ending[15:0] address
- cmp.w drDATA,drEA ; is EA < end
- bcc lNextC_2 ; no, next
-
- swap drDATA ; get start
- cmp.w drDATA,drEA ; is EA >= start
- bcs lNextC_2 ; no, next
-
- sub.w drDATA,drEA ; convert EA to (0-999)
- move.w drEA,-(SP)
- move.w (arEA),-(SP) ; get scan line offset
- jsr plot_C ; go plot a text character
- lea 10(SP),SP
- bra wsDLC_exit
-
- lNextC_2:
- move.w (arEA)+,drDATA
- bpl lNextC_1 ; next, if not end of list
- addq.l #6,SP
-
- wsDLC_exit:
- movem.l (SP)+,D0-D7/A0-A6
- DISPATCH
-
- ; handler for ANTIC mode D
- wsDLD:
- move.w (SP)+,drDATA
- movem.l D0-D7/A0-A6,-(SP)
- move.l drEA,arEA
- cmp.b (arEA),drDATA ; compare with byte in memory
- beq wsDLD_exit ; if same, just exit
-
- move.b drDATA,(arEA) ; store new byte to memory
- tst.w fRedraw ; if redraw flag, exit
- bne wsDLD_exit
-
- move.w #1,-(SP) ; count of characters
- move.l arEA,-(SP) ; pointer to character to plot
-
- lea rgDLD,arEA ; get start of DL structure
- lNextD_1:
- move.l (arEA)+,drDATA ; get start[31:16] and ending[15:0] address
- cmp.w drDATA,drEA ; is EA < end
- bcc lNextD_2 ; no, next
-
- swap drDATA ; get start
- cmp.w drDATA,drEA ; is EA >= start
- bcs lNextD_2 ; no, next
-
- sub.w drDATA,drEA ; convert EA to (0-999)
- move.w drEA,-(SP)
- move.w (arEA),-(SP) ; get scan line offset
- jsr plot_D ; go plot a graphics byte
- lea 10(SP),SP
- bra wsDLD_exit
-
- lNextD_2:
- move.w (arEA)+,drDATA
- bpl lNextD_1 ; next, if not end of list
- addq.l #6,SP
-
- wsDLD_exit:
- movem.l (SP)+,D0-D7/A0-A6
- DISPATCH
-
- ; handler for ANTIC mode E
- wsDLE:
- move.w (SP)+,drDATA
- movem.l D0-D7/A0-A6,-(SP)
- move.l drEA,arEA
- cmp.b (arEA),drDATA ; compare with byte in memory
- beq wsDLE_exit ; if same, just exit
-
- move.b drDATA,(arEA) ; store new byte to memory
- tst.w fRedraw ; if redraw flag, exit
- bne wsDLE_exit
-
- move.w #1,-(SP) ; count of characters
- move.l arEA,-(SP) ; pointer to character to plot
-
- lea rgDLE,arEA ; get start of DL structure
- lNextE_1:
- move.l (arEA)+,drDATA ; get start[31:16] and ending[15:0] address
- cmp.w drDATA,drEA ; is EA < end
- bcc lNextE_2 ; no, next
-
- swap drDATA ; get start
- cmp.w drDATA,drEA ; is EA >= start
- bcs lNextE_2 ; no, next
-
- sub.w drDATA,drEA ; convert EA to (0-999)
- move.w drEA,-(SP)
- move.w (arEA),-(SP) ; get scan line offset
- jsr plot_E ; go plot a graphics byte
- lea 10(SP),SP
- bra wsDLE_exit
-
- lNextE_2:
- move.w (arEA)+,drDATA
- bpl lNextE_1 ; next, if not end of list
- addq.l #6,SP
-
- wsDLE_exit:
- movem.l (SP)+,D0-D7/A0-A6
- DISPATCH
-
- ; handler for ANTIC mode F
- wsDLF:
- move.w (SP)+,drDATA
- movem.l D0-D7/A0-A6,-(SP)
- move.l drEA,arEA
- cmp.b (arEA),drDATA ; compare with byte in memory
- beq wsDLF_exit ; if same, just exit
-
- move.b drDATA,(arEA) ; store new byte to memory
- tst.w fRedraw ; if redraw flag, exit
- bne wsDLF_exit
-
- move.w #1,-(SP) ; count of characters
- move.l arEA,-(SP) ; pointer to character to plot
-
- lea rgDLF,arEA ; get start of DL structure
- lNextF_1:
- move.l (arEA)+,drDATA ; get start[31:16] and ending[15:0] address
- cmp.w drDATA,drEA ; is EA < end
- bcc lNextF_2 ; no, next
-
- swap drDATA ; get start
- cmp.w drDATA,drEA ; is EA >= start
- bcs lNextF_2 ; no, next
-
- sub.w drDATA,drEA ; convert EA to (0-999)
- move.w drEA,-(SP)
- move.w (arEA),-(SP) ; get scan line offset
- jsr plot_F ; go plot a graphics byte
- lea 10(SP),SP
- bra wsDLF_exit
-
- lNextF_2:
- move.w (arEA)+,drDATA
- bpl lNextF_1 ; next, if not end of list
- addq.l #6,SP
-
- wsDLF_exit:
- movem.l (SP)+,D0-D7/A0-A6
- DISPATCH
-
- wsBXX:
- addq.l #2,SP
- DISPATCH
-
- ; read service routines
-
- rsB00:
- rts
-
- ; XL RAM handling ($C000-$FFFF)
- rsB01:
- rts
-
- rsB02:
- rts
- rsB03:
- rts
- rsB04:
- rts
- rsB05:
- rts
- rsB06:
- rts
- rsB07:
- rts
- rsB08:
- rts
- rsB09:
- rts
- rsB0A:
- rts
- rsB0B:
- rts
-
- rsPIA00:
- ; joystick stuff
- move.l drEA,arEA
- move.w Joy0,drDATA
- move.w drDATA,drEA
- lsl.w #4,drEA
- lsr.w #8,drDATA
- andi.w #0x00F0,drEA
- andi.w #0x000F,drDATA
- or.w drEA,drDATA
- not.w drDATA
- move.b drDATA,(arEA)
- rts
-
- rsPIA01:
- ; joystick stuff
- move.l drEA,arEA
- tst.w fAtariXL
- bne.s rsPIA01XL
-
- move.w Joy0,drDATA
- move.w drDATA,drEA
- lsl.w #4,drEA
- lsr.w #8,drDATA
- andi.w #0x00F0,drEA
- andi.w #0x000F,drDATA
- or.w drEA,drDATA
- not.w drDATA
- move.b drDATA,(arEA)
- rsPIA01_x:
- rts
- rsPIA01XL:
- ori.w #0x00FC,drEA
- move.l drEA,arEA
- bra rsPIA01_x
-
- rsPIA02:
- move.b #0x00,(arEA)
- rts
- rsPIA03:
- move.b #0x00,(arEA)
- rts
-
- rsGTIA00:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0x00,(arEA)
- rts
- rsGTIA01:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0x00,(arEA)
- rts
- rsGTIA02:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0x00,(arEA)
- rts
- rsGTIA03:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0x00,(arEA)
- rts
- rsGTIA04:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0x00,(arEA)
- rts
- rsGTIA05:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0x00,(arEA)
- rts
- rsGTIA06:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0x00,(arEA)
- rts
- rsGTIA07:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0x00,(arEA)
- rts
- rsGTIA08:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0x00,(arEA)
- rts
- rsGTIA09:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0x00,(arEA)
- rts
- rsGTIA0A:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0x00,(arEA)
- rts
- rsGTIA0B:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0x00,(arEA)
- rts
- rsGTIA0C:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0x00,(arEA)
- rts
- rsGTIA0D:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0x00,(arEA)
- rts
- rsGTIA0E:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0x00,(arEA)
- rts
- rsGTIA0F:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0x00,(arEA)
- rts
-
- ; $D010 TRIG0
- rsGTIA10:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b Joy0,drDATA
- lsr.b #7,drDATA
- not.w drDATA
- andi.w #1,drDATA
- move.b drDATA,(arEA)
- rts
-
- ; $D011 TRIG1
- rsGTIA11:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.w Joy0,drDATA
- lsr.b #7,drDATA
- not.w drDATA
- andi.w #1,drDATA
- move.b drDATA,(arEA)
- rts
-
- ; $D012 TRIG2
- rsGTIA12:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b Joy0,drDATA
- lsr.b #7,drDATA
- not.w drDATA
- andi.w #1,drDATA
- move.b drDATA,(arEA)
- rts
-
- ; $D013 TRIG3
- rsGTIA13:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.w Joy0,drDATA
- lsr.b #7,drDATA
- not.w drDATA
- andi.w #1,drDATA
- move.b drDATA,(arEA)
- rts
-
- ; PAL - return US TV = $0E
- rsGTIA14:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0x0E,(arEA)
- rts
-
- ; unused on 8 bit, normally returns $0F - use as Xformer detect byte
- rsGTIA15:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0xC0,(arEA)
- rts
-
- rsGTIA16:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsGTIA17:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsGTIA18:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsGTIA19:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsGTIA1A:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsGTIA1B:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsGTIA1C:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsGTIA1D:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsGTIA1E:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
-
- ; $D01F CONSOL - set by keyboard interrupt
- rsGTIA1F:
- andi.w #0xFF1F,drEA
- move.l drEA,arEA
- rts
-
- ; $D200-$D207 = paddle values
- rsPOK00:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #228,(arEA)
- rts
- rsPOK01:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #228,(arEA)
- rts
- rsPOK02:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #228,(arEA)
- rts
- rsPOK03:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #228,(arEA)
- rts
- rsPOK04:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #228,(arEA)
- rts
- rsPOK05:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #228,(arEA)
- rts
- rsPOK06:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #228,(arEA)
- rts
- rsPOK07:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #228,(arEA)
- rts
-
- rsPOK08:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
-
- ; $D209 KBCODE - keyboard code, set by keyboard interrupt
- rsPOK09:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- rts
-
- ; $D20A - random number generator
- rsPOK0A:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b 0x465,drDATA
- or.b Joy0,drDATA
- add.b 0x8209,drDATA
- move.b drDATA,(arEA)
- rts
-
- rsPOK0B:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsPOK0C:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsPOK0D:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
-
- ; $D20E - IRQ status, altered by interrupt handler
- rsPOK0E:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b bIRQ(arEMUL),drDATA ; IRQ status is active low
- not.b drDATA
- move.b drDATA,(arEA) ; stuff in IRQ status
- rts
-
- ; $D20F - SKSTAT - already set from interrupt code and $D20A
- rsPOK0F:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- rts
-
- rsANT00:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsANT01:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsANT02:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsANT03:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsANT04:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsANT05:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsANT06:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsANT07:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsANT08:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsANT09:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
-
- ; $D40A - WSYNC
- rsANT0A:
- muls D0,D0
- muls D0,D0
- muls D0,D0
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
-
- ; $D40B - VCOUNT
- rsANT0B:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b 0x8207,-(SP)
- move.w (SP)+,drDATA
- move.b 0x8209,drDATA
- andi.l #0x00007FFF,drDATA
- divu #293,drDATA
- add.w #16,drDATA
- move.b drDATA,(arEA)
- rts
-
- rsANT0C:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsANT0D:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsANT0E:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b #0xFF,(arEA)
- rts
- rsANT0F:
- andi.w #0xFF0F,drEA
- move.l drEA,arEA
- move.b bNMI(arEMUL),(arEA) ; stuff in NMI status
- rts
-
- rsBXX:
- rts
-
-
- ; This is the 6502 interrupt handler.
- ; It determines what the interrupt is, sets appropriate hardware registers
- ; and jumps through $FFFE if it is an IRQ, or $FFFA is it is a NMI
-
- #ifdef DEBUG
- dc.w 'At', 'ar', 'iI', 'nt', 0
- #endif
-
- LAtariInt:
- move.w #OP_EMUL,(arEMUL) ; restore dispatcher
-
- move.b bNMI(arEMUL),D0 ; get interrupt byte
- beq LtryIRQ ; branch to IRQ if NMI is zero
-
-
- ; it is a NMI
-
- #ifdef NDEBUG
- move.l lScr,arEA
- move.b D0,5(arEA)
- move.b D0,85(arEA)
- move.b D0,165(arEA)
- move.b D0,245(arEA)
- move.b D0,325(arEA)
- move.b D0,405(arEA)
- st 485(arEA)
- #endif
-
- bsr LPush ; save P and PC
- st bI(arEMUL) ; turn on I flag
-
- #ifdef NDEBUG
- move.l lScr,arEA
- not 2(arEA)
- not 82(arEA)
- not 162(arEA)
- not 242(arEA)
- not 322(arEA)
- not 402(arEA)
- #endif
-
- move.w #0xFFFA,drEA
- move.l drEA,arPC
- jmp 0x4C06(arEMUL) ; jmp($FFFA)
-
-
- ; it is an IRQ
-
- LtryIRQ:
- move.b bIRQ(arEMUL),D0 ; get interrupt byte
- beq LexitInt ; exit if not IRQ????
-
- #ifdef NDEBUG
- move.l lScr,arEA
- move.b D0,6(arEA)
- move.b D0,86(arEA)
- move.b D0,166(arEA)
- move.b D0,246(arEA)
- move.b D0,326(arEA)
- move.b D0,406(arEA)
- st 486(arEA)
- #endif
-
- bsr LPush ; save P and PC
- st bI(arEMUL) ; turn on I flag
-
- move.w #0xFFFE,drEA
- move.l drEA,arPC
- jmp 0x4C06(arEMUL) ; jmp($FFFE)
-
- LexitInt:
- #ifdef NDEBUG
- move.l lScr,arEA
- not 52(arEA)
- not 132(arEA)
- not 212(arEA)
- not 292(arEA)
- not 372(arEA)
- not 452(arEA)
- #endif
- DISPATCH
-
- LPush:
- subq.b #3,drSP
- move.l drSP,arEA
- move.l arPC,drEA
- move.b drEA,2(arEA) ; push PClo
- lsr.w #8,drEA
- move.b drEA,3(arEA) ; push PChi
- ST_to_P
- move.b bRegP(arEMUL),1(arEA) ; push P
- rts
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; This is the VBI routine
- ; Force a NMI interrupt on the 6502
- ; and update any hardware registers we can, like joysticks, etc...
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- #ifdef DEBUG
- dc.w 'At', 'ar', 'iV', 'BI', 0
- #endif
-
- Lmod:
- dc.w 0
-
- LAtariVBI:
- lea 0x8800,A0
- lea rgbSound,A1
- moveq #3,D7 ; count of available sound registers
- move.w #0xFF,D6 ; sound enable mask
- move.b 8(A1),D5 ; audio control register
-
- LdoS1:
- moveq #0,D0
- move.b (A1)+,D0 ; get freq #1
- move.b (A1)+,D1 ; get volume #1
- move.b D1,D2
- tst.b D0
- beq LdoS2
-
- andi.w #0x0F,D2 ; isolate volume
- andi.w #0xA0,D1 ; check distortion or pure tone
- cmpi.w #0xA0,D1
- bne LdoS1D
-
- add.w D0,D0 ; do pure tone
- add.w D0,D0 ; multiply freq by 4
- move.b #0,(A0)
- move.b D0,2(A0)
- lsr.w #8,D0
- move.b #1,(A0)
- move.b D0,2(A0)
-
- move.b #8,(A0) ; volume voice #0
- move.b D2,2(A0)
- andi.b #0xFE,D6 ; enable voice #0
- bra LdoS2
-
- LdoS1D:
- lsr.b #2,D0 ; do distortion
- move.b #6,(A0)
- move.b D0,2(A0)
-
- move.b #8,(A0) ; volume voice #0
- move.b D2,2(A0)
- andi.b #0xF7,D6 ; enable noise #0
-
- LdoS2:
- moveq #0,D0
- move.b (A1)+,D0 ; get freq #2
- move.b (A1)+,D1 ; get volume #2
- move.b D1,D2
- tst.b D0
- beq LdoS3
-
- andi.w #0x0F,D2 ; isolate volume
- andi.w #0xA0,D1 ; check distortion or pure tone
- cmpi.w #0xA0,D1
- bne LdoS2D
-
- add.w D0,D0 ; do pure tone
- add.w D0,D0 ; multiply freq by 4
- move.b #2,(A0)
- move.b D0,2(A0)
- lsr.w #8,D0
- move.b #3,(A0)
- move.b D0,2(A0)
-
- move.b #9,(A0) ; volume voice B
- move.b D2,2(A0)
- andi.b #0xFD,D6 ; enable voice B
- bra LdoS3
-
- LdoS2D:
- lsr.b #2,D0 ; do distortion
- move.b #6,(A0)
- move.b D0,2(A0)
-
- move.b #9,(A0) ; volume voice B
- move.b D2,2(A0)
- andi.b #0xEF,D6 ; enable noise B
-
- LdoS3:
- moveq #0,D0
- move.b (A1)+,D0 ; get freq #3
- move.b (A1)+,D1 ; get volume #3
- move.b D1,D2
- tst.b D0
- beq LdoS4
-
- andi.w #0x0F,D2 ; isolate volume
- andi.w #0xA0,D1 ; check distortion or pure tone
- cmpi.w #0xA0,D1
- bne LdoS3D
-
- add.w D0,D0 ; do pure tone
- add.w D0,D0 ; multiply freq by 4
- move.b #4,(A0)
- move.b D0,2(A0)
- lsr.w #8,D0
- move.b #5,(A0)
- move.b D0,2(A0)
-
- move.b #10,(A0) ; volume voice C
- move.b D2,2(A0)
- andi.b #0xFB,D6 ; enable voice C
- bra LdoS
-
- LdoS3D:
- lsr.b #2,D0 ; do distortion
- move.b #6,(A0)
- move.b D0,2(A0)
-
- move.b #10,(A0) ; volume voice C
- move.b D2,2(A0)
- andi.b #0xDF,D6 ; enable noise C
- bra LdoS
-
- LdoS4:
- ; ori.b #0x24,D6 ; turn off C noise (keyclick)
-
- LdoS:
- move.b #7,(A0) ; store voice enable bits
- move.b D6,2(A0)
-
- LVBI2:
- addq.w #1,wVBIcount
- move.w wVBIcount,D0
- cmp.w wVBIrate,D0
- bne LAtVBIexit ; skip wVBIrate VBI's
-
- clr.w wVBIcount
-
- tst.b fXLRAM ; are we bank selected?
- bne LAtVBIexit ; yep, exit
-
- move.l lMemory,D0
- move.w #0xD4FE,D0
- move.l D0,A0
- btst #BIT_VBI,(A0) ; check if VBIs enabled
- beq LAtVBIexit
-
- move.l lEmul,A0
- bset #BIT_VBI,bNMI(A0) ; set a NMI interrupt
- bne LAtVBIexit ; exit if already set
-
- move.w #OP_INT,(A0)
-
- LAtVBIexit:
- lea Lmod(PC),A0
- addi.w #1,(A0)
- move.w (A0),D0
- cmpi.w #13,D0
- bcs LAV2
-
- clr.w (A0)
-
- #ifdef NDEBUG
- move.l lScr,arEA
- not.b (arEA)
- not.b 84(arEA)
- not.b 164(arEA)
- not.b 244(arEA)
- not.b 324(arEA)
- not.b 404(arEA)
- #endif
-
- tst.w fRedraw ; if fRedraw then go do a global screen redraw
- beq LAV3 ; go test PMG redraw
-
- tst.w fAtDMA ; if DMA disabled, get out
- beq LAV2
-
- movem.l D0-D7/A0-A6,-(SP)
- jsr AtariRedraw
- movem.l (SP)+,D0-D7/A0-A6
- clr.w fRedraw
- bra LAV2
-
- LAV3:
- tst.w fPMGRedraw
- beq LAV2
-
- movem.l D0-D7/A0-A6,-(SP)
- jsr redraw_PMG
- movem.l (SP)+,D0-D7/A0-A6
- clr.w fPMGRedraw
-
- LAV2:
- rts
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;
- ; Keyboard handler to map the ST scan code to an 8 bit internal scan code.
- ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ; some safety room
- dc.w 0
-
- #ifdef DEBUG
- dc.w 'Ke', 'yP', 'at', 'ch', 0
- #endif
-
- Joy0:
- dc.w 0
- semaJoy:
- dc.w 0
-
- KeyPatch:
-
- ; A1 = lScr, for debugging purposes
- movem.l A0-A1/D0-D1,-(SP)
-
- #ifdef DEBUG
- move.l oldKey,A0
- jsr (A0)
- #endif
-
- clr.w D0
- move.b 0xFC02,D0
-
- tst.w semaJoy
- bne LgetJoy
-
- cmpi.b #0xF6,D0 ; check for a keypress
- bcs Lkp1
-
- cmpi.b #0xFE,D0 ; if not joystick event, get out
- bcs Lkpexit
-
- not.b D0
- andi.w #0x01,D0
- addq.b #1,D0
- move.w D0,semaJoy ; set joystick semaphore
- bra Lkpexit ; and go exit so next interrupt can occur
-
- LgetJoy:
- move.w semaJoy,D1
- lea Joy0,A1
- move.b D0,-1(A1,D1.w) ; store joystick packet
- clr.w semaJoy
-
- #ifdef NDEBUG
- move.l lScr,A1
- lea 32000(A1),A1
- move.b D0,68(A1)
- move.b D0,148(A1)
- st 228(A1)
- lea Joy0,A0
- move.b (A0)+,D0
- move.b D0,308(A1)
- st 388(A1)
- move.b (A0),D0
- move.b D0,468(A1)
- st 548(A1)
- #endif
-
- bra Lkpexit
-
- Lkp1:
- cmpi.b #0x3F,D0
- bne Lkp2
-
- move.l lEmul,A0
- move.w #OP_RTS,(A0) ; hit F5, so exit
- bra Lkpexit
-
- Lkp2:
- cmpi.b #0x44,D0 ; F10 key is SYSTEM RESET (always enabled)
- bne Lkp3
-
- move.l lEmul,A0
- bset #BIT_RESET,bNMI(A0) ; set a NMI interrupt for the RESET key
- bne Lkpexit ; exit if already set
-
- move.b bNMI(A0),D0
- andi.b #~INT_RESET,D0 ; or if already NMI pending...
- bne Lkpexit ; don't alter dispatcher
-
- move.w #OP_INT,(A0)
- bra Lkpexit
-
- Lkp3:
- cmpi.b #0x61,D0 ; UNDO key is BREAK
- bne Lkp4
-
- move.l lEmul,A0
- btst #BIT_BREAK,bIRQmask(A0) ; check if BREAK is enabled
- beq Lkpexit ; exit if not
-
- bset #BIT_BREAK,bIRQ(A0) ; set a IRQ interrupt for the BREAK key
- ; bne Lkpexit ; exit of already set
-
- tst.b bI(A0)
- bne Lkpexit ; if I bit set...
-
- move.b bIRQ(A0),D0
- andi.b #~INT_BREAK,D0 ; or if already interrupt pending...
- ; bne Lkpexit ; don't alter dispatcher
-
- move.w #OP_INT,(A0)
- bra Lkpexit
-
- Lkp4:
- Lkp10:
- move.l lEmul,A0
- move.l lMemory,D1
- move.w #0xD01F,D1
- move.l D1,A0 ; A0 = pointer to mem[$D01F]
-
- cmpi.b #0xC1,D0 ; F7 is START
- bne Lkp11
-
- ori.b #0x01,(A0)
- bra Lkpexit
-
- Lkp11:
- cmpi.b #0x41,D0
- bne Lkp12
-
- andi.b #~0x01,(A0)
- bra Lkpexit
-
- Lkp12:
- cmpi.b #0xC2,D0 ; F8 is SELECT
- bne Lkp13
-
- ori.b #0x02,(A0)
- bra Lkpexit
-
- Lkp13:
- cmpi.b #0x42,D0
- bne Lkp14
-
- andi.b #~0x02,(A0)
- bra Lkpexit
-
- Lkp14:
- cmpi.b #0xC3,D0 ; F9 is OPTION
- bne Lkp15
-
- ori.b #0x04,(A0)
- bra Lkpexit
-
- Lkp15:
- cmpi.b #0x43,D0
- bne Lkp20
-
- andi.b #~0x04,(A0)
- bra Lkpexit
-
- ; Check control and shift keys
- ; The byte bShift contains b1 = control b0 = shift key
- ; The byte bShifts contains b1 = right shift b0 = left shift
- Lkp20:
- lea bShift(PC),A0
- cmpi.b #0x1D,D0 ; Control key
- bne Lkp21
-
- bset #1,(A0)
- #ifdef DEBUG
- move.b bShift(PC),20(A1)
- move.b bShift(PC),100(A1)
- move.b bShift(PC),180(A1)
- st 500(A1)
- #endif
- bra Lkpexit
-
- Lkp21:
- cmpi.b #0x9D,D0 ; Control key up
- bne Lkp22
-
- bclr #1,(A0)
- #ifdef DEBUG
- move.b bShift(PC),20(A1)
- move.b bShift(PC),100(A1)
- move.b bShift(PC),180(A1)
- st 500(A1)
- #endif
- bra Lkpexit
-
- Lkp22:
- lea bShifts(PC),A0
- cmpi.b #0x2A,D0 ; left shift down
- bne Lkp23
-
- bset #0,(A0)
- bra LShifts
-
- Lkp23:
- cmpi.b #0xAA,D0 ; left shift up
- bne Lkp24
-
- bclr #0,(A0)
- bra LShifts
-
- Lkp24:
- cmpi.b #0x36,D0 ; right shift down
- bne Lkp25
-
- bset #1,(A0)
- bra LShifts
-
- Lkp25:
- cmpi.b #0xB6,D0 ; right shift down
- bne Lkp30
-
- bclr #1,(A0)
-
- LShifts:
- move.b (A0),D0 ; get shift keys status
- lea bShift(PC),A0
- tst.b D0 ; any shift key pressed
- bne lShiftDown
- bclr #0,(A0) ; no, clear shift bit in bShift
- bra lSh2
- lShiftDown:
- bset #0,(A0) ; yes, set shift but
-
- lSh2:
- #ifdef DEBUG
- move.b bShift(PC),20(A1)
- move.b bShift(PC),100(A1)
- move.b bShift(PC),180(A1)
- move.b bShifts(PC),260(A1)
- move.b bShifts(PC),340(A1)
- move.b bShifts(PC),420(A1)
- st 500(A1)
- #endif
- bra Lkpexit
-
- Lkp30:
- move.b #0xFF,D1 ; assume scan code will be $FF
- btst #7,D0 ; if up stroke, definately $FF
- bne lStoreKey
-
- andi.w #0x7F,D0 ; else key pressed, look up in table
- add.w D0,D0
- add.w D0,D0
- or.b bShift(PC),D0
- lea mpSTto8(PC),A0
- move.b 0(A0,D0.w),D1
-
- #ifdef DEBUG
- move.w D0,10(A1)
- move.w D0,90(A1)
- move.w D0,170(A1)
- move.w D0,250(A1)
- st 330(A1)
- st 411(A1)
- #endif
-
- lStoreKey:
- move.l lEmul,A0 ; get pointer to mem[$D209]
- move.l lMemory,D0
- move.w #0xD209,D0
- move.l D0,A0
- move.b D1,(A0) ; and store scan code
-
- #ifdef DEBUG
- move.b D1,13(A1)
- move.b D1,93(A1)
- move.b D1,173(A1)
- move.b D1,253(A1)
- move.b D1,333(A1)
- st 413(A1)
- #endif
-
- ; set bits in $D20F
- move.w #0xD20F,D0
- move.l D0,A0
- move.b bShift(PC),D0
- btst #0,D0
- beq lShiftUp
- bclr #3,(A0) ; shift key still pressed
- bra lSK2
- lShiftUp:
- bset #3,(A0)
-
- lSK2:
- cmpi.b #0xFF,D1
- beq lKeyUp
- bclr #2,(A0) ; key still pressed
-
- ; if key just pressed, force IRQ
- move.l lEmul,A0
- btst #BIT_KEY,bIRQmask(A0) ; check if keyboard int enabled
- beq lSK3 ; exit if not
-
- bset #BIT_KEY,bIRQ(A0) ; set a IRQ interrupt for the key
- ; bne lSK3 ; exit if already set
-
- tst.b bI(A0)
- bne lSK3 ; if I bit set...
-
- move.b bIRQ(A0),D0
- andi.b #~INT_KEY,D0 ; or if already interrupt pending...
- ; bne lSK3 ; don't alter dispatcher
-
- move.w #OP_INT,(A0)
- bra lSK3
-
- lKeyUp:
- bset #2,(A0)
-
- lSK3:
- nop
-
- Lkpexit:
- movem.l (SP)+,A0-A1/D0-D1
- rts
-
- oldKey:
- dc.l 0
-
- bShift:
- dc.w 0 ; bit 0 = any shift bit 1 = control
- bShifts:
- dc.w 0 ; bit 0 = left shift bit 1 = right shift
-
-
- ; Lookup table to map the ST's scan codes to the 8 bit internal code
- ; Keys that do not apply map to $FF
- ; There are 4 entries per line, regular, shift, control, control shift
-
- dc.w 'KB', 'DT', 'BL', 0
-
- mpSTto8:
- dc.w 0xFFFF, 0xFFFF ; $00
- dc.w 0x1C5C, 0x9CDC ; $01 Esc
- dc.w 0x1F5F, 0x9FDF ; $02 1
- dc.w 0x1E75, 0x9EDE ; $03 2 map to @ not "
- dc.w 0x1A5A, 0x9ADA ; $04 3
- dc.w 0x1858, 0x98D8 ; $05 4
- dc.w 0x1D5D, 0x9DDD ; $06 5
- dc.w 0x1B47, 0x9BDB ; $07 6 map to ^ not &
- dc.w 0x335B, 0xB3F3 ; $08 7 map to & not '
- dc.w 0x3507, 0xB5F5 ; $09 8 map to * not @
- dc.w 0x3070, 0xB0F0 ; $0A 9
- dc.w 0x3272, 0xB2F2 ; $0B 0
- dc.w 0x0E4E, 0x8ECE ; $0C -
- dc.w 0x0F06, 0x8FCF ; $0D =
- dc.w 0x3474, 0xB4F4 ; $0E Backspace
- dc.w 0x2C6C, 0xACEC ; $0F Tab
- dc.w 0x2F6F, 0xAFEF ; $10 q
- dc.w 0x2E6E, 0xAEEE ; $11 w
- dc.w 0x2A6A, 0xAAEA ; $12 e
- dc.w 0x2868, 0xA8E8 ; $13 r
- dc.w 0x2D6D, 0xADED ; $14 t
- dc.w 0x2B6B, 0xABEB ; $15 y
- dc.w 0x0B4B, 0x8BCB ; $16 u
- dc.w 0x0D4D, 0x8DCD ; $17 i
- dc.w 0x0848, 0x88C8 ; $18 o
- dc.w 0x0A4A, 0x8ACA ; $19 p
- dc.w 0x6060, 0xA0E0 ; $1A [
- dc.w 0x6262, 0xA2E2 ; $1B ]
- dc.w 0x0C4C, 0x8CCC ; $1C Return
- dc.w 0xFFFF, 0xFFFF ; $1D Control
- dc.w 0x3F7F, 0xBFFF ; $1E a
- dc.w 0x3E7E, 0xBEFE ; $1F s
- dc.w 0x3A7A, 0xBAFA ; $20 d
- dc.w 0x3878, 0xB8F8 ; $21 f
- dc.w 0x3D7D, 0xB8F8 ; $22 g
- dc.w 0x3979, 0xB9F9 ; $23 h
- dc.w 0x0141, 0x81C1 ; $24 j
- dc.w 0x0545, 0x85C5 ; $25 k
- dc.w 0x0040, 0x80C0 ; $26 l
- dc.w 0x0242, 0x82C2 ; $27 ;
- dc.w 0x735E, 0xB3F3 ; $28 ' map to " not 7
- dc.w 0xFFFF, 0xFFFF ; $29 `
- dc.w 0xFFFF, 0xFFFF ; $2A l shift
- dc.w 0x664F, 0xE6E6 ; $2B \
- dc.w 0x1757, 0x97D7 ; $2C z
- dc.w 0x1656, 0x96D6 ; $2D x
- dc.w 0x1252, 0x92D2 ; $2E c
- dc.w 0x1050, 0x90D0 ; $2F v
- dc.w 0x1555, 0x95D5 ; $30 b
- dc.w 0x2363, 0xA3E3 ; $31 n
- dc.w 0x2565, 0xA5E5 ; $32 m
- dc.w 0x2037, 0xA0E0 ; $33 ,
- dc.w 0x2236, 0xA2E2 ; $34 .
- dc.w 0x2666, 0xA6E6 ; $35 /
- dc.w 0xFFFF, 0xFFFF ; $36 r shift
- dc.w 0xFFFF, 0xFFFF ; $37
- dc.w 0x2767, 0xA7E7 ; $38 alt = atari key
- dc.w 0x2161, 0xA1E1 ; $39 space
- dc.w 0x3C7C, 0xBCFC ; $3A caps
- dc.w 0xFFFF, 0xFFFF ; $3B F1
- dc.w 0xFFFF, 0xFFFF ; $3C F2
- dc.w 0xFFFF, 0xFFFF ; $3D F3
- dc.w 0xFFFF, 0xFFFF ; $3E F4
- dc.w 0xFFFF, 0xFFFF ; $3F F5
- dc.w 0xFFFF, 0xFFFF ; $40 F6
- dc.w 0xFFFF, 0xFFFF ; $41 F7
- dc.w 0xFFFF, 0xFFFF ; $42 F8
- dc.w 0xFFFF, 0xFFFF ; $43 F9
- dc.w 0xFFFF, 0xFFFF ; $44 F10
- dc.w 0xFFFF, 0xFFFF ; $45
- dc.w 0xFFFF, 0xFFFF ; $46
- dc.w 0x7676, 0xB6F6 ; $47 Home
- dc.w 0x0E4E, 0x8ECE ; $48 up arrow
- dc.w 0xFFFF, 0xFFFF ; $49
- dc.w 0x0E4E, 0x8ECE ; $4A pad -
- dc.w 0x0646, 0x86C6 ; $4B l arrow
- dc.w 0xFFFF, 0xFFFF ; $4C
- dc.w 0x0747, 0x87C7 ; $4D r arrow
- dc.w 0x0646, 0x86C6 ; $4E pad +
- dc.w 0xFFFF, 0xFFFF ; $4F
- dc.w 0x0F4F, 0x8FCF ; $50 d arrow
- dc.w 0xFFFF, 0xFFFF ; $51
- dc.w 0x3777, 0xB7F7 ; $52 Insert
- dc.w 0x3474, 0xB4F4 ; $53 Delete
- dc.w 0xFFFF, 0xFFFF ; $54
- dc.w 0xFFFF, 0xFFFF ; $55
- dc.w 0xFFFF, 0xFFFF ; $56
- dc.w 0xFFFF, 0xFFFF ; $57
- dc.w 0xFFFF, 0xFFFF ; $58
- dc.w 0xFFFF, 0xFFFF ; $59
- dc.w 0xFFFF, 0xFFFF ; $5A
- dc.w 0xFFFF, 0xFFFF ; $5B
- dc.w 0xFFFF, 0xFFFF ; $5C
- dc.w 0xFFFF, 0xFFFF ; $5D
- dc.w 0xFFFF, 0xFFFF ; $5E
- dc.w 0xFFFF, 0xFFFF ; $5F
- dc.w 0xFFFF, 0xFFFF ; $60
- dc.w 0xFFFF, 0xFFFF ; $61 Undo
- dc.w 0xFFFF, 0xFFFF ; $62 Help
- dc.w 0x7070, 0xB0F0 ; $63 pad (
- dc.w 0x7272, 0xB2F2 ; $64 pad )
- dc.w 0x2666, 0xA6E6 ; $65 pad /
- dc.w 0x0747, 0x87C7 ; $66 pad *
- dc.w 0x3373, 0xB3F3 ; $67 pad 7
- dc.w 0x3575, 0xB5F5 ; $68 pad 8
- dc.w 0x3070, 0xB0F0 ; $69 pad 9
- dc.w 0x1858, 0x98D8 ; $6A pad 4
- dc.w 0x1D5D, 0x9DDD ; $6B pad 5
- dc.w 0x1B5B, 0x9BDB ; $6C pad 6
- dc.w 0x1F5F, 0x9FDF ; $6D pad 1
- dc.w 0x1E5E, 0x9EDE ; $6E pad 2
- dc.w 0x1A5A, 0x9ADA ; $6F pad 3
- dc.w 0x3272, 0xB2F2 ; $70 pad 0
- dc.w 0x2262, 0xA2E2 ; $71 pad .
- dc.w 0x0C4C, 0x8CCC ; $72 Enter
- dc.w 0xFFFF, 0xFFFF ; $73
- dc.w 0xFFFF, 0xFFFF ; $74
- dc.w 0xFFFF, 0xFFFF ; $75
- dc.w 0xFFFF, 0xFFFF ; $76
- dc.w 0xFFFF, 0xFFFF ; $77
- dc.w 0xFFFF, 0xFFFF ; $78
- dc.w 0xFFFF, 0xFFFF ; $79
- dc.w 0xFFFF, 0xFFFF ; $7A
- dc.w 0xFFFF, 0xFFFF ; $7B
- dc.w 0xFFFF, 0xFFFF ; $7C
- dc.w 0xFFFF, 0xFFFF ; $7D
- dc.w 0xFFFF, 0xFFFF ; $7E
- dc.w 0xFFFF, 0xFFFF ; $7F
-
-
-
- ; add more assembler code here:
-
- }
- }
-
-